Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
USER_MANAGEMENT_ADD = "user_management_add",
USER_MANAGEMENT_UPDATE = "user_management_update",
USER_MANAGEMENT_DELETE = "user_management_delete",
}
const permissions: string[] = _.values(PermissionName);
@Table({
tableName: "permission",
})
export class Permission extends Model {
public id: number;
@Column({
type: DataType.ENUM(permissions),
allowNull: false,
validate: {
isIn: [permissions],
},
unique: true,
})
name: PermissionName;
@Column({
type: DataType.STRING,
})
description: string;
}
import Experiment from "./experiment";
export const InstructionTypes = [
"root",
"honestOracle",
"maliciousOracle",
"returningRoot",
"returningHonestOracle",
"returningMaliciousOracle",
"lazyPointerUnlock",
];
@Table
export default class Instructions extends Model {
@AllowNull(false)
@Column(DataType.ENUM({ values: InstructionTypes }))
public type: string;
@AllowNull(false)
@Column(DataType.TEXT)
public value: string;
@ForeignKey(() => Experiment)
@Column(DataType.UUID)
public experimentId: string;
@BelongsTo(() => Experiment)
public experiment: Experiment;
}
public id: number;
public static PUBLIC_ATTRIBUTES: (keyof File)[] = [
"type",
"name",
"title",
];
@Column({
type: DataType.DATE,
allowNull: false,
})
uploadDate: Date;
@Column({
type: DataType.ENUM(types),
allowNull: false,
validate: {
isIn: [types],
},
})
type: FileType;
@Column({ allowNull: false })
title: string;
@Column({ type: DataType.STRING })
description: string;
@Column({ allowNull: false })
key: string;
@Table({
indexes: [
{
unique: true,
fields: ["contactId"],
},
],
tableName: "user",
})
export class User extends Model {
public id: number;
public static PUBLIC_ATTRIBUTES: (keyof User)[] = ["role", "isActive"];
@Column({
type: DataType.ENUM(roles),
allowNull: false,
validate: {
isIn: [roles],
},
})
role: UserRole;
@Column({
type: DataType.BOOLEAN,
})
isActive?: boolean;
@Column({
type: DataType.STRING,
allowNull: false,
})
}
export type RoleWildcard = "*";
export const RoleWildcard = "*";
const roles: string[] = _.values(RoleName);
@Table({
tableName: "role",
})
export class Role extends Model {
public id: number;
@Column({
type: DataType.ENUM(roles),
allowNull: false,
unique: true,
validate: {
isIn: [roles],
},
})
name: RoleName;
@Column({
type: DataType.STRING,
})
description: string;
}
export default class Property extends Model {
public static TYPES = TYPES
public static SCOPES = SCOPES
@AutoIncrement
@PrimaryKey
@Column
id: number
static attributes: any
@AllowNull(false)
@Default(SCOPES.RESPONSE)
@Column({
type: DataType.ENUM(SCOPES.REQUEST, SCOPES.RESPONSE),
comment: 'property owner',
})
scope: string
@AllowNull(false)
@Column({
type: DataType.ENUM(TYPES.STRING, TYPES.NUMBER, TYPES.BOOLEAN, TYPES.OBJECT, TYPES.ARRAY, TYPES.FUNCTION, TYPES.REGEXP, TYPES.Null),
comment: 'property type',
})
/** Data Type */
type: string
@AllowNull(false)
@Default(2)
@Column
/** request params type (position) */
CREATE = 'create', UPDATE = 'update', DELETE = 'delete',
LOCK = 'lock', UNLOCK = 'unlock', JOIN = 'join', EXIT = 'exit',
}
@Table({ paranoid: true, freezeTableName: false, timestamps: true })
export default class Logger extends Model {
public static TYPES = types
@AutoIncrement
@PrimaryKey
@Column
id: number
@AllowNull(false)
@Column({
type: DataType.ENUM(types.CREATE, types.UPDATE, types.DELETE, types.LOCK, types.UNLOCK, types.JOIN, types.EXIT),
comment: 'operation type',
})
type: string
@ForeignKey(() => User)
@Column
creatorId: number
@AllowNull(false)
@ForeignKey(() => User)
@Column
userId: number
@ForeignKey(() => Organization)
@Column
organizationId: number
id: number
static attributes: any
@AllowNull(false)
@Default(SCOPES.RESPONSE)
@Column({
type: DataType.ENUM(SCOPES.REQUEST, SCOPES.RESPONSE),
comment: 'property owner',
})
scope: string
@AllowNull(false)
@Column({
type: DataType.ENUM(TYPES.STRING, TYPES.NUMBER, TYPES.BOOLEAN, TYPES.OBJECT, TYPES.ARRAY, TYPES.FUNCTION, TYPES.REGEXP, TYPES.Null),
comment: 'property type',
})
/** Data Type */
type: string
@AllowNull(false)
@Default(2)
@Column
/** request params type (position) */
pos: number
@AllowNull(false)
@Column(DataType.STRING(256))
name: string
@Column({ type: DataType.STRING(128), comment: 'property generation rules' })