@@ -7,7 +7,7 @@ import { generate } from './password-hash';
77/**
88 * 记录信息的mixin
99 */
10- export const InfoCrudMixin = {
10+ export let InfoCrudMixin = {
1111 attributes : { } ,
1212 options : {
1313 createdAt : 'create_time' ,
@@ -30,7 +30,7 @@ export const InfoCrudMixin = {
3030/**
3131 * 用户接口
3232 */
33- export const UserInterface = {
33+ export let UserInterface = {
3434 attributes : {
3535 id : {
3636 type : Sequelize . INTEGER ,
@@ -78,28 +78,37 @@ export const UserInterface = {
7878 }
7979 }
8080 } ,
81- options : merge (
82- {
83- tableName : 'lin_user' ,
84- getterMethods : {
85- isAdmin ( ) {
86- // @ts -ignore
87- return this . getDataValue ( 'admin' ) === UserAdmin . ADMIN ;
88- } ,
89- isActive ( ) {
90- // @ts -ignore
91- return this . getDataValue ( 'active' ) === UserActive . ACTIVE ;
92- }
81+ options : {
82+ tableName : 'lin_user' ,
83+ createdAt : 'create_time' ,
84+ updatedAt : 'update_time' ,
85+ deletedAt : 'delete_time' ,
86+ paranoid : true ,
87+ getterMethods : {
88+ isAdmin ( ) {
89+ // @ts -ignore
90+ return this . getDataValue ( 'admin' ) === UserAdmin . ADMIN ;
91+ } ,
92+ isActive ( ) {
93+ // @ts -ignore
94+ return this . getDataValue ( 'active' ) === UserActive . ACTIVE ;
95+ } ,
96+ createTime ( ) {
97+ // @ts -ignore
98+ return dayjs ( this . getDataValue ( 'create_time' ) ) . unix ( ) * 1000 ;
99+ } ,
100+ updateTime ( ) {
101+ // @ts -ignore
102+ return dayjs ( this . getDataValue ( 'update_time' ) ) . unix ( ) * 1000 ;
93103 }
94- } ,
95- InfoCrudMixin . options
96- )
104+ }
105+ }
97106} ;
98107
99108/**
100109 * 权限接口
101110 */
102- export const AuthInterface = {
111+ export let AuthInterface = {
103112 attributes : {
104113 id : {
105114 type : Sequelize . INTEGER ,
@@ -127,7 +136,7 @@ export const AuthInterface = {
127136/**
128137 * 分组接口
129138 */
130- export const GroupInterface = {
139+ export let GroupInterface = {
131140 attributes : {
132141 id : {
133142 type : Sequelize . INTEGER ,
@@ -152,7 +161,7 @@ export const GroupInterface = {
152161/**
153162 * 日志接口
154163 */
155- export const LogInterface = {
164+ export let LogInterface = {
156165 attributes : {
157166 id : {
158167 type : Sequelize . INTEGER ,
@@ -198,7 +207,7 @@ export const LogInterface = {
198207/**
199208 * 文件接口
200209 */
201- export const FileInterface = {
210+ export let FileInterface = {
202211 id : {
203212 type : Sequelize . INTEGER ,
204213 primaryKey : true ,
0 commit comments