1- import { Entity , Column , PrimaryColumn , CreateDateColumn , UpdateDateColumn , ManyToMany , JoinTable } from "typeorm"
2- import { DeepOptional } from "typing-assets"
3- import { Note } from "./Note"
4-
5- export namespace UserEntity {
6-
7- @Entity ( )
8- export class User {
9- @PrimaryColumn ( "varchar" )
10- public login : string
11-
12- @Column ( "varchar" , {
13- length : 60 ,
14- nullable : false
15- } )
16- public email : string
17-
18- @Column ( "text" )
19- public password : string
20-
21- @Column ( "varchar" , {
22- length : 32
23- } )
24- public username : string
25-
26- @Column ( "varchar" , {
27- length : 7 ,
28- nullable : false
29- } )
30- public personalColor : string
31-
32- @Column ( "boolean" , {
33- nullable : false
34- } )
35- public isCollaborating : boolean
36-
37- // @Column ("text", {
38- // nullable: true
39- // })
40- // public validToken: string
41-
42-
43-
44- @CreateDateColumn ( { type : "timestamp" , default : ( ) => "CURRENT_TIMESTAMP(6)" } )
45- public createdAt : Date ;
46-
47- @UpdateDateColumn ( { type : "timestamp" , default : ( ) => "CURRENT_TIMESTAMP(6)" , onUpdate : "CURRENT_TIMESTAMP(6)" } )
48- public updatedAt : Date ;
49- }
50- }
51-
52- export type User = UserEntity . User
53- export type UserUpdate = DeepOptional <
54- Omit < User , "updatedAt" | "createdAt" | "email" | "login" >
55- >
56- export type UserCredentials = Pick < User , "email" | "password" >
57- export type UserWithoutSensetives = Omit < User , "password" >
1+ import { Entity , Column , PrimaryColumn , CreateDateColumn , UpdateDateColumn } from "typeorm"
2+ import { DeepOptional } from "typing-assets"
3+
4+ export namespace UserEntity {
5+
6+ @Entity ( )
7+ export class User {
8+ @PrimaryColumn ( "varchar" )
9+ public login : string
10+
11+ @Column ( "varchar" , {
12+ length : 60 ,
13+ nullable : false
14+ } )
15+ public email : string
16+
17+ @Column ( "text" )
18+ public password : string
19+
20+ @Column ( "varchar" , {
21+ length : 32
22+ } )
23+ public username : string
24+
25+ @Column ( "varchar" , {
26+ length : 7 ,
27+ nullable : false
28+ } )
29+ public personalColor : string
30+
31+ @Column ( "boolean" , {
32+ nullable : false
33+ } )
34+ public isCollaborating : boolean
35+
36+ // @Column ("text", {
37+ // nullable: true
38+ // })
39+ // public validToken: string
40+
41+
42+
43+ @CreateDateColumn ( { type : "timestamp" , default : ( ) => "CURRENT_TIMESTAMP(6)" } )
44+ public createdAt : Date ;
45+
46+ @UpdateDateColumn ( { type : "timestamp" , default : ( ) => "CURRENT_TIMESTAMP(6)" , onUpdate : "CURRENT_TIMESTAMP(6)" } )
47+ public updatedAt : Date ;
48+ }
49+ }
50+
51+ export type User = UserEntity . User
52+ export type UserUpdate = DeepOptional <
53+ Omit < User , "updatedAt" | "createdAt" | "email" | "login" >
54+ >
55+ export type UserCredentials = Pick < User , "email" | "password" >
56+ export type UserWithoutSensetives = Omit < User , "password" >
5857export type UserWithoutMetadata = Omit < User , "updatedAt" | "createdAt" >
0 commit comments