Commit d091f7d 1 parent bc0870c commit d091f7d Copy full SHA for d091f7d
File tree 1 file changed +63
-0
lines changed
1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { Prop , Schema , SchemaFactory } from '@nestjs/mongoose' ;
2
+ import mongoose , { HydratedDocument , Types } from 'mongoose' ;
3
+ import { Tariff } from './tariff.schema' ;
4
+
5
+ export type UserDocument = HydratedDocument < User > ;
6
+
7
+ @Schema ( )
8
+ export class User {
9
+ @Prop ( {
10
+ required : true ,
11
+ unique : true ,
12
+ } )
13
+ userId : number ;
14
+
15
+ @Prop ( {
16
+ required : true ,
17
+ unique : true ,
18
+ } )
19
+ token ?: string ;
20
+
21
+ @Prop ( )
22
+ username : string ;
23
+
24
+ @Prop ( )
25
+ password ?: string ;
26
+
27
+ @Prop ( {
28
+ required : true ,
29
+ unique : true ,
30
+ default ( ) {
31
+ return this . userId ;
32
+ } ,
33
+ } )
34
+ email ?: string ;
35
+
36
+ @Prop ( {
37
+ default : ( ) => 0 ,
38
+ } )
39
+ requestsUsed ?: number ;
40
+
41
+ @Prop ( {
42
+ default : ( ) => '6016bed198ebf72bc112edae' ,
43
+ type : mongoose . Schema . Types . ObjectId ,
44
+ ref : Tariff . name ,
45
+ } )
46
+ tariffId ?: Types . ObjectId ;
47
+
48
+ @Prop ( {
49
+ default : ( ) => false ,
50
+ } )
51
+ inChat ?: boolean ;
52
+
53
+ @Prop ( { isOptional : true } )
54
+ isSubscribed ?: boolean ;
55
+
56
+ @Prop ( { isOptional : true , type : Date } )
57
+ subscriptionStartDate ?: Date ;
58
+
59
+ @Prop ( { isOptional : true , type : Date } )
60
+ subscriptionEndDate ?: Date ;
61
+ }
62
+
63
+ export const UserSchema = SchemaFactory . createForClass ( User ) ;
You can’t perform that action at this time.
0 commit comments