This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { DataTypes, Op } from 'sequelize';
|
||||
import { DataTypes } from 'sequelize';
|
||||
import { env } from '$env/dynamic/private';
|
||||
import { building, dev } from '$app/environment';
|
||||
import * as bcrypt from 'bcrypt';
|
||||
@@ -53,6 +53,8 @@ export class Report extends Model {
|
||||
declare notice: string;
|
||||
@Column({ type: DataTypes.STRING })
|
||||
declare statement: string;
|
||||
@Column({ type: DataTypes.DATE })
|
||||
declare striked_at: Date | null;
|
||||
@Column({ type: DataTypes.INTEGER, allowNull: false })
|
||||
@ForeignKey(() => User)
|
||||
declare reporter_id: number;
|
||||
@@ -66,17 +68,26 @@ export class Report extends Model {
|
||||
@ForeignKey(() => StrikeReason)
|
||||
declare strike_reason_id: number | null;
|
||||
|
||||
@BelongsTo(() => User, 'reporter_id')
|
||||
@BelongsTo(() => User, {
|
||||
onDelete: 'CASCADE',
|
||||
foreignKey: 'reporter_id'
|
||||
})
|
||||
declare reporter: User;
|
||||
@BelongsTo(() => User, 'reported_id')
|
||||
@BelongsTo(() => User, {
|
||||
onDelete: 'CASCADE',
|
||||
foreignKey: 'reported_id'
|
||||
})
|
||||
declare reported: User;
|
||||
@BelongsTo(() => Admin, 'auditor_id')
|
||||
@BelongsTo(() => Admin, {
|
||||
onDelete: 'CASCADE',
|
||||
foreignKey: 'auditor_id'
|
||||
})
|
||||
declare auditor: Admin;
|
||||
@BelongsTo(() => StrikeReason, 'strike_reason_id')
|
||||
@BelongsTo(() => StrikeReason, {
|
||||
onDelete: 'CASCADE',
|
||||
foreignKey: 'strike_reason_id'
|
||||
})
|
||||
declare strike_reason: StrikeReason;
|
||||
|
||||
@Column({ type: DataTypes.DATE })
|
||||
declare striked_at: Date | null;
|
||||
}
|
||||
|
||||
@Table({ modelName: 'strike_reason', underscored: true, createdAt: false, updatedAt: false })
|
||||
@@ -110,7 +121,10 @@ export class Feedback extends Model {
|
||||
@ForeignKey(() => User)
|
||||
declare user_id: number;
|
||||
|
||||
@BelongsTo(() => User, 'user_id')
|
||||
@BelongsTo(() => User, {
|
||||
onDelete: 'CASCADE',
|
||||
foreignKey: 'user_id'
|
||||
})
|
||||
declare user: User;
|
||||
}
|
||||
|
||||
@@ -153,7 +167,6 @@ export class Settings extends Model {
|
||||
@Column({
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
get(this: Settings): any {
|
||||
const value = this.getDataValue('value');
|
||||
return value != null ? JSON.parse(value) : null;
|
||||
|
||||
Reference in New Issue
Block a user