File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed
Projects/BooksLibrary/src/database/sql/sequelize/models Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change 1+ /* eslint-disable indent */
2+ import {
3+ Table ,
4+ Column ,
5+ Model ,
6+ DataType ,
7+ CreatedAt ,
8+ UpdatedAt ,
9+ DeletedAt ,
10+ IsUUID ,
11+ PrimaryKey ,
12+ IsInt ,
13+ ForeignKey ,
14+ } from 'sequelize-typescript' ;
15+
16+ import { v4 } from 'uuid' ;
17+ import Role from './role.model' ;
18+
19+ ///////////////////////////////////////////////////////////////////////
20+
21+ @Table ( {
22+ timestamps : true ,
23+ modelName : 'RolePrivilege' ,
24+ tableName : 'role_privileges' ,
25+ paranoid : true ,
26+ freezeTableName : true ,
27+ } )
28+ export default class RolePrivilege extends Model {
29+ @IsUUID ( 4 )
30+ @PrimaryKey
31+ @Column ( {
32+ type : DataType . UUID ,
33+ defaultValue : ( ) => {
34+ return v4 ( ) ;
35+ } ,
36+ allowNull : false ,
37+ } )
38+ id : string ;
39+
40+ @Column ( {
41+ type : DataType . STRING ( 256 ) ,
42+ allowNull : false ,
43+ } )
44+ Privilege : string ;
45+
46+ @IsInt
47+ @ForeignKey ( ( ) => Role )
48+ @Column ( {
49+ type : DataType . INTEGER ,
50+ allowNull : false ,
51+ } )
52+ RoleId : number ;
53+
54+ @Column
55+ @CreatedAt
56+ CreatedAt : Date ;
57+
58+ @UpdatedAt
59+ UpdatedAt : Date ;
60+
61+ @DeletedAt
62+ DeletedAt : Date ;
63+ }
You can’t perform that action at this time.
0 commit comments