add feedback endpoint (#28) and some other stuff
All checks were successful
delpoy / build-and-deploy (push) Successful in 1m11s
All checks were successful
delpoy / build-and-deploy (push) Successful in 1m11s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { DataTypes } from 'sequelize';
|
||||
import { DataTypes, Op } from 'sequelize';
|
||||
import { env } from '$env/dynamic/private';
|
||||
import { building, dev } from '$app/environment';
|
||||
import * as bcrypt from 'bcrypt';
|
||||
@@ -97,6 +97,23 @@ export class StrikePunishment extends Model {
|
||||
declare punishment_in_seconds: number;
|
||||
}
|
||||
|
||||
@Table({ modelName: 'feedback', underscored: true })
|
||||
export class Feedback extends Model {
|
||||
@Column({ type: DataTypes.STRING, allowNull: false, unique: true })
|
||||
@Index
|
||||
declare url_hash: string;
|
||||
@Column({ type: DataTypes.STRING, allowNull: false })
|
||||
declare event: string;
|
||||
@Column({ type: DataTypes.STRING })
|
||||
declare content: string;
|
||||
@Column({ type: DataTypes.INTEGER })
|
||||
@ForeignKey(() => User)
|
||||
declare user_id: number;
|
||||
|
||||
@BelongsTo(() => User, 'user_id')
|
||||
declare user: User;
|
||||
}
|
||||
|
||||
@Table({ modelName: 'admin', underscored: true })
|
||||
export class Admin extends Model {
|
||||
@Column({ type: DataTypes.STRING, allowNull: false, unique: true })
|
||||
@@ -148,5 +165,5 @@ export class Settings extends Model {
|
||||
export const sequelize = new Sequelize(building ? 'sqlite::memory:' : env.DATABASE_URI, {
|
||||
// only log sql queries in dev mode
|
||||
logging: dev ? console.log : false,
|
||||
models: [User, Report, StrikeReason, StrikePunishment, Admin, Settings]
|
||||
models: [User, Report, StrikeReason, StrikePunishment, Feedback, Admin, Settings]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user