This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Providern, TokenProvider, LocalsContainer, Type} from "./interfaces"; | |
import {getDeps} from "./getDeps"; | |
export class InjectorService { | |
#cache = new Map<TokenProvider, any>(); | |
constructor() { | |
// make injector service to be injectable | |
this.set(InjectorService, this); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Adapters } from "@tsed/adapters"; | |
import { LocalsContainer, PlatformTest } from "@tsed/common"; | |
import Redis from "ioredis"; | |
// @ts-ignore | |
import IORedisMock from "ioredis-mock"; | |
import moment from "moment"; | |
import { REDIS_CONNECTION } from "../redis/RedisConnection"; | |
import { OIDCRedisAdapter } from "./OIDCRedisAdapter"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export abstract class BaseEntityController { | |
readonly entity: string; | |
@Get('/') | |
list() { | |
return [] | |
} | |
/// etc | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {createInjector, InjectorService, Provider} from "@tsed/common"; | |
import {Store} from "@tsed/core"; | |
export class BullBuilder { | |
readonly injector: InjectorService; | |
constructor(settings: any) { | |
this.injector = createInjector({ | |
settings, | |
providers: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller } from "@tsed/common"; | |
import { Inject, Injectable } from "@tsed/di"; | |
import AWS from "aws-sdk"; | |
@Controller("/medias") | |
export class MediasController { | |
@Inject() | |
protected s3: S3Client; | |
@Get() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Module, Configuration, Inject, Constant, InjectorService} from "@tsed/di"; | |
import {PlatformApplication} from "@tsed/common"; | |
import {MongooseService} from "@tsed/mongoose"; | |
import {Logger} from "@tsed/logger"; | |
import {Type} from "@tsed/core"; | |
import AdminBro from "admin-bro"; | |
import AdminBroExpress from "@admin-bro/express"; | |
import AdminBroMongoose from "@admin-bro/mongoose"; | |
AdminBro.registerAdapter(AdminBroMongoose) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { isArray } from "@tsed/core"; | |
import { deserialize } from "@tsed/json-mapper"; | |
import { Injectable, Inject } from "@tsed/di"; | |
import { PrismaService } from "../services/PrismaService"; | |
import { Prisma, User } from "../client"; | |
import { UserModel } from "../models"; | |
@Injectable() | |
export class UsersRepository { | |
@Inject() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { User } from "@prisma/client"; | |
import { Integer, Required, Property, Groups, Format, Email, Description, Allow, Enum, CollectionOf } from "@tsed/schema"; | |
import { Role, PostModel } from "@tsedio/prisma"; | |
export class UserModel implements User { | |
@Property(Number) | |
@Integer() | |
@Required() | |
@Groups("!creation") | |
id: number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model User { | |
/// @TsED.Groups("!creation") | |
/// Comment | |
id Int @id @default(autoincrement()) | |
createdAt DateTime @default(now()) | |
/// @TsED.Email() | |
/// @TsED.Description("User email. This email must be unique!") | |
email String @unique | |
weight Float? | |
is18 Boolean? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {BodyParams, Controller, Get, PathParams, Post} from "@tsed/common"; | |
import {Inject} from "@tsed/di"; | |
import {PrismaService} from "../services/PrismaService"; | |
import {Groups, Required, Email, Returns, Summary} from "@tsed/schema"; | |
import {User} from "@prisma/client"; | |
class UserModel implements User { | |
@Required() | |
@Groups("!creation") | |
id: number; |
NewerOlder