How to use the @typegoose/typegoose.getModelForClass function in @typegoose/typegoose

To help you get started, we’ve selected a few @typegoose/typegoose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github L-Leite / cso2-users-service / src / entities / uservars.ts View on Github external
.exec()
    }

    /**
     * create a new document
     */
    private static async createDoc(): Promise {
        const newInfo = new UserVarsModel({ nextUserId: DEFAULT_NEXTUSERID_VALUE })
        await newInfo.save()
    }

    @typegoose.prop()
    public nextUserId?: number
}

const UserVarsModel = typegoose.getModelForClass(UserVars)
github L-Leite / cso2-users-service / src / entities / user.ts View on Github external
public rank: number
    @typegoose.prop({ default: 1, required: true })
    public vipLevel: number
    @typegoose.prop({ default: 1, min: 0, max: 7, required: true })
    public wins: number
    @typegoose.prop({ default: 0, required: true  })
    public losses: number
    @typegoose.prop({ default: 0, required: true  })
    public kills: number
    @typegoose.prop({ default: 0, required: true  })
    public deaths: number
    @typegoose.prop({ default: 0, required: true  })
    public assists: number
}

const UserModel = typegoose.getModelForClass(User)
github L-Leite / cso2-users-service / src / entities / usersession.ts View on Github external
@typegoose.prop({ default: new SessionNetworkInfo(), required: true })
    public externalNet: SessionNetworkInfo
    @typegoose.prop({ default: new SessionNetworkInfo(), required: true })
    public internalNet: SessionNetworkInfo

    @typegoose.prop({ default: 0, required: true })
    public currentChannelServerIndex: number
    @typegoose.prop({ default: 0, required: true })
    public currentChannelIndex: number

    @typegoose.prop({ default: 0, required: true })
    public currentRoomId: number
}

const UserSessionModel = typegoose.getModelForClass(UserSession)

@typegoose/typegoose

Define Mongoose models using TypeScript classes

MIT
Latest version published 19 days ago

Package Health Score

88 / 100
Full package analysis