diff --git a/src/models/Member.model.ts b/src/models/Member.model.ts index 380ced47..34cfa60b 100644 --- a/src/models/Member.model.ts +++ b/src/models/Member.model.ts @@ -1,10 +1,11 @@ -import { index, prop, Severity } from '@typegoose/typegoose'; +import { index, modelOptions, prop, Severity } from '@typegoose/typegoose'; export enum Role { ORG_ADMIN = 'org_admin', REGULAR = 'regular', } +@modelOptions({ schemaOptions: { collection: 'members' } }) @index( { orgName: 1, name: 1 }, { unique: true, partialFilterExpression: { name: { $type: 'string' } } }, diff --git a/src/models/MemberBundleRequest.model.ts b/src/models/MemberBundleRequest.model.ts index 7ed6ca31..2740d67e 100644 --- a/src/models/MemberBundleRequest.model.ts +++ b/src/models/MemberBundleRequest.model.ts @@ -1,5 +1,6 @@ -import { prop } from '@typegoose/typegoose'; +import { modelOptions, prop } from '@typegoose/typegoose'; +@modelOptions({ schemaOptions: { collection: 'member_bundle_requests' } }) export class MemberBundleRequestModelSchema { @prop({ required: true, unique: true }) public publicKeyId!: string; diff --git a/src/models/MemberKeyImportToken.model.ts b/src/models/MemberKeyImportToken.model.ts index 1214ed9a..43779a53 100644 --- a/src/models/MemberKeyImportToken.model.ts +++ b/src/models/MemberKeyImportToken.model.ts @@ -1,5 +1,6 @@ -import { prop } from '@typegoose/typegoose'; +import { modelOptions, prop } from '@typegoose/typegoose'; +@modelOptions({ schemaOptions: { collection: 'member_key_import_tokens' } }) export class MemberKeyImportTokenModelSchema { @prop({ required: true }) public memberId!: string; diff --git a/src/models/MemberPublicKey.model.ts b/src/models/MemberPublicKey.model.ts index f5b3863a..4b8fb5de 100644 --- a/src/models/MemberPublicKey.model.ts +++ b/src/models/MemberPublicKey.model.ts @@ -2,6 +2,8 @@ import { prop, modelOptions } from '@typegoose/typegoose'; @modelOptions({ schemaOptions: { + collection: 'member_public_keys', + timestamps: { createdAt: 'creationDate', updatedAt: false, diff --git a/src/models/Org.model.ts b/src/models/Org.model.ts index ffa80cbe..333759c0 100644 --- a/src/models/Org.model.ts +++ b/src/models/Org.model.ts @@ -1,5 +1,6 @@ -import { prop } from '@typegoose/typegoose'; +import { modelOptions, prop } from '@typegoose/typegoose'; +@modelOptions({ schemaOptions: { collection: 'orgs' } }) export class OrgModelSchema { @prop({ required: true, unique: true, index: true }) public name!: string;