返回 AiToEarn
channel-auth-identity.schema.ts
根目录 / project / aitoearn-backend / libs / channel-db / src / schemas / channel-auth-identity.schema.ts
1 import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
2 import { AccountType } from '@yikart/common'
3 import { DEFAULT_SCHEMA_OPTIONS } from '../channel-db.constants'
4 import { BaseTemp } from './time.tamp'
5
6 @Schema({ ...DEFAULT_SCHEMA_OPTIONS, collection: 'channelAuthIdentity' })
7 export class ChannelAuthIdentity extends BaseTemp {
8 id: string
9
10 @Prop({
11 required: true,
12 enum: AccountType,
13 index: true,
14 })
15 platform: AccountType
16
17 @Prop({
18 required: true,
19 type: String,
20 index: true,
21 })
22 subjectUid: string
23
24 @Prop({
25 required: true,
26 type: String,
27 index: true,
28 })
29 userId: string
30 }
31
32 export const ChannelAuthIdentitySchema = SchemaFactory.createForClass(ChannelAuthIdentity)
33 ChannelAuthIdentitySchema.index({ platform: 1, subjectUid: 1 }, { unique: true })
34
34 lines TYPESCRIPT