45 lines
641 B
TypeScript
45 lines
641 B
TypeScript
|
import {
|
||
|
Table,
|
||
|
AutoIncrement,
|
||
|
Column,
|
||
|
CreatedAt,
|
||
|
UpdatedAt,
|
||
|
Model,
|
||
|
PrimaryKey,
|
||
|
HasMany,
|
||
|
ForeignKey,
|
||
|
BelongsTo
|
||
|
} from "sequelize-typescript";
|
||
|
|
||
|
import User from "./User";
|
||
|
|
||
|
@Table
|
||
|
class UserOnlineTime extends Model<UserOnlineTime> {
|
||
|
@PrimaryKey
|
||
|
@AutoIncrement
|
||
|
@Column
|
||
|
id: number;
|
||
|
|
||
|
@Column
|
||
|
status: string;
|
||
|
|
||
|
@Column
|
||
|
onlineTime: Date;
|
||
|
|
||
|
@CreatedAt
|
||
|
createdAt: Date;
|
||
|
|
||
|
@UpdatedAt
|
||
|
updatedAt: Date;
|
||
|
|
||
|
@ForeignKey(() => User)
|
||
|
@Column
|
||
|
userId: number;
|
||
|
|
||
|
@BelongsTo(() => User)
|
||
|
user: User;
|
||
|
|
||
|
}
|
||
|
|
||
|
export default UserOnlineTime;
|
||
|
|