Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@BeforeCreate({ name: "giveId" }) static async giveId(instance: User) {
instance._id = uuid();
instance.password = await bcrypt.hash(instance.password, 10);
}
@Column name: string;
@Column({
primaryKey: true
})
// tslint:disable-next-line: variable-name
_id: string;
@Column email: string;
@Column password: string;
@Column active: boolean;
@HasMany(() => Post, "authorId")
posts: Post[];
}
@BelongsTo(() => User, 'ownerId')
owner: User
@BelongsTo(() => Organization, 'organizationId')
organization: Organization
@BelongsTo(() => User, 'lockerId')
locker: User
@BelongsToMany(() => User, 'repositories_members', 'repositoryId', 'userId')
members: User[]
@HasMany(() => Module, 'repositoryId')
modules: Module[]
@HasMany(() => Module, 'repositoryId')
interfaces: Interface[]
@BelongsToMany(() => Repository, () => RepositoriesCollaborators, 'repositoryId', 'collaboratorId')
collaborators: Repository[]
@BelongsToMany(() => Repository, () => RepositoriesCollaborators, 'collaboratorId')
repositories: Repository[]
}
@ForeignKey(() => User)
@Column
creatorId: number
@ForeignKey(() => Repository)
@Column
repositoryId: number
@BelongsTo(() => User, 'creatorId')
creator: User
@BelongsTo(() => Repository, 'repositoryId')
repository: Repository
@HasMany(() => Interface, 'moduleId')
interfaces: Interface[]
}
@Column
repositoryId: number
@BelongsTo(() => User, 'creatorId')
creator: User
@BelongsTo(() => User, 'lockerId')
locker: User
@BelongsTo(() => Module, 'moduleId')
module: Module
@BelongsTo(() => Repository, 'repositoryId')
repository: Repository
@HasMany(() => Property, 'interfaceId')
properties: Property[]
}
@Column
ownerId: number
@BelongsTo(() => User, 'creatorId')
creator: User
@BelongsTo(() => User, 'ownerId')
owner: User
@BelongsToMany(() => User, () => OrganizationsMembers)
members: User[]
@HasMany(() => OrganizationsMembers)
organizationMembersList: OrganizationsMembers[]
@HasMany(() => Repository, 'organizationId')
repositories: Repository[]
}
@Column(DataType.STRING(32))
password: string
@AllowNull(false)
@Unique
@Column(DataType.STRING(128))
email: string
@HasMany(() => Organization, 'ownerId')
ownedOrganizations: Organization[]
@BelongsToMany(() => Organization, () => OrganizationsMembers)
joinedOrganizations: Organization[]
@HasMany(() => Repository, 'ownerId')
ownedRepositories: Repository[]
@BelongsToMany(() => Repository, () => RepositoriesMembers)
joinedRepositories: Repository[]
}
@Default(true)
@Column(DataType.BOOLEAN)
public areNewWorkspacesOracleOnlyByDefault: boolean;
@BelongsToMany(() => Tree, "ExperimentTreeRelation", "ExperimentId", "TreeId")
public trees: Tree[];
@BelongsToMany(
() => Experiment,
"FallbackRelation",
"primaryExperimentId",
"fallbackExperimentId",
)
public fallbacks: Experiment[];
@HasMany(() => Instructions, "experimentId")
public instructions: Instructions[];
@HasMany(() => NotificationRequest, "experimentId")
public notificationRequests: NotificationRequest[];
@AfterCreate
public static async createDefaultInstructions(experiment: Experiment) {
await Instructions.bulkCreate([
{
experimentId: experiment.id,
type: "root",
value: defaultRootInstructions,
},
{
experimentId: experiment.id,
type: "honestOracle",
@Column(DataType.STRING)
public email: string;
@Column(DataType.STRING)
public gender: string;
@Column(DataType.STRING)
public pictureURL: string;
@Column(DataType.BOOLEAN)
public isAdmin: boolean;
@BelongsToMany(() => Tree, () => UserTreeOracleRelation)
public OracleTrees: Tree[];
@HasMany(() => NotificationRequest, "userId")
public notificationRequests: NotificationRequest[];
}