Merge branch 'develop' of Software_Engineering_I/greenvironment-server into master
commit
15939bca7c
@ -0,0 +1,10 @@
|
||||
import {BaseError} from "./BaseError";
|
||||
|
||||
/**
|
||||
* Represents an error that is thrown when a blacklisted phrase is used.
|
||||
*/
|
||||
export class BlacklistedError extends BaseError {
|
||||
constructor(public phrases: string[], field: string = "input") {
|
||||
super(`The ${field} contains the blacklisted words: ${phrases.join(",")}`);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
import * as sqz from "sequelize";
|
||||
import {
|
||||
BelongsTo,
|
||||
BelongsToMany,
|
||||
Column,
|
||||
ForeignKey,
|
||||
HasMany,
|
||||
Model,
|
||||
NotNull,
|
||||
Table,
|
||||
Unique,
|
||||
} from "sequelize-typescript";
|
||||
|
||||
/**
|
||||
* Represents a blacklisted phrase
|
||||
*/
|
||||
@Table({underscored: true})
|
||||
export class BlacklistedPhrase extends Model {
|
||||
|
||||
/**
|
||||
* The phrase that is blacklisted
|
||||
*/
|
||||
@NotNull
|
||||
@Unique
|
||||
@Column({allowNull: false, unique: true})
|
||||
public phrase: string;
|
||||
|
||||
/**
|
||||
* An optional language
|
||||
*/
|
||||
@Column({type: sqz.STRING(2), defaultValue: "en"})
|
||||
public language: string;
|
||||
}
|
Loading…
Reference in New Issue