Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
before(() => {
this.getParamTypesStub = Sinon.stub(Metadata, "getParamTypes").returns([]);
this.setParamTypesStub = Sinon.stub(Metadata, "setParamTypes");
Inject(String)(Test.prototype, "propertyKey", 0);
});
after(() => {
before(() => {
Inject(String)(Test.prototype, "test");
this.store = Store.from(Test).get("injectableProperties");
});
public constructor(@Inject(User) private userModel: MongooseModel) {}
import {Inject, Service} from "@tsed/common";
import {MongooseModel} from "@tsed/mongoose";
import {$log} from "ts-log-debug";
import {Calendar} from "../../models/calendars/Calendar";
@Service()
export class CalendarsService {
@Inject(Calendar)
private Calendar: MongooseModel;
$onInit() {
this.reload();
}
async reload() {
const calendars = await this.Calendar.find({});
if (calendars.length === 0) {
const promises = require("../../../resources/calendars.json").map(calendar => this.save(calendar));
await Promise.all(promises);
}
}
/**
export function IO(target: Type, targetKey: string, descriptor: TypedPropertyDescriptor | number) {
return Inject(SocketIOServer)(target, targetKey, descriptor);
}
constructor(
private injector: InjectorService,
@Inject(HttpServer) private httpServer: HttpServer,
@Inject(HttpsServer) private httpsServer: HttpsServer,
@IO private io: SocketIO.Server,
private socketIOService: SocketIOService
) {}
constructor(
private injector: InjectorService,
@Inject(HttpServer) private httpServer: HttpServer,
@Inject(HttpsServer) private httpsServer: HttpsServer,
@IO private io: SocketIO.Server,
private serverSettingsService: ServerSettingsService,
private converterService: ConverterService
) {}
constructor(
private injector: InjectorService,
@Inject(HttpServer) private httpServer: HttpServer,
@Inject(HttpsServer) private httpsServer: HttpsServer,
@IO private io: SocketIO.Server,
private serverSettingsService: ServerSettingsService,
private converterService: ConverterService
) {}
constructor(
private injector: InjectorService,
@Inject(HttpServer) private httpServer: HttpServer,
@Inject(HttpsServer) private httpsServer: HttpsServer,
@IO private io: SocketIO.Server,
private socketIOService: SocketIOService
) {}
constructor(
private injector: InjectorService,
@Inject(HttpServer) private httpServer: HttpServer,
@Inject(HttpsServer) private httpsServer: HttpsServer,
@IO private io: SocketIO.Server,
private serverSettingsService: ServerSettingsService,
private converterService: ConverterService
) {}