How to use the sequelize-typescript.BelongsTo function in sequelize-typescript

To help you get started, we’ve selected a few sequelize-typescript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thx / rap2-delos / src / models / bo / interface.ts View on Github external
@Column
  creatorId: number

  @ForeignKey(() => User)
  @Column
  lockerId: number

  @ForeignKey(() => Module)
  @Column
  moduleId: number

  @ForeignKey(() => Repository)
  @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[]

}
github thx / rap2-delos / src / models / bo / property.ts View on Github external
@ForeignKey(() => User)
  @Column
  creatorId: number

  @ForeignKey(() => Module)
  @Column
  moduleId: number

  @ForeignKey(() => Repository)
  @Column
  repositoryId: number

  @BelongsTo(() => User, 'creatorId')
  creator: User

  @BelongsTo(() => Interface, 'interfaceId')
  interface: Interface

  @BelongsTo(() => Module, 'moduleId')
  module: Module

  @BelongsTo(() => Repository, 'repositoryId')
  repository: Repository

  @Column
  /** 是否为必填选项 */
  required: boolean

}
github thx / rap2-delos / src / models / bo / property.ts View on Github external
moduleId: number

  @ForeignKey(() => Repository)
  @Column
  repositoryId: number

  @BelongsTo(() => User, 'creatorId')
  creator: User

  @BelongsTo(() => Interface, 'interfaceId')
  interface: Interface

  @BelongsTo(() => Module, 'moduleId')
  module: Module

  @BelongsTo(() => Repository, 'repositoryId')
  repository: Repository

  @Column
  /** 是否为必填选项 */
  required: boolean

}
github birkir / prime / packages / prime-core / src / models / ContentType.ts View on Github external
@Column(DataType.JSONB)
  public settings: any;

  @Column(DataType.UUID)
  public userId: any;

  @HasMany(() => ContentEntry, {
    onUpdate: 'SET NULL',
    onDelete: 'SET NULL',
  })
  public contentEntries: ContentEntry;

  @HasMany(() => ContentTypeField)
  public fields: ContentTypeField[];

  @BelongsTo(() => User, 'userId')
  public user: User;
}
github thx / rap2-delos / src / models / bo / organization.ts View on Github external
logo: string

  @AllowNull(false)
  @Default(true)
  @Column({ comment: 'true:public, false:private' })
  visibility: boolean

  @ForeignKey(() => User)
  @Column
  creatorId: number

  @ForeignKey(() => User)
  @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[]
}
github thx / rap2-delos / src / models / bo / repository.ts View on Github external
@Column
  ownerId: number

  @ForeignKey(() => Organization)
  @Column
  organizationId: number

  @ForeignKey(() => User)
  @Column
  creatorId: number

  @ForeignKey(() => User)
  @Column
  lockerId: number

  @BelongsTo(() => User, 'creatorId')
  creator: User

  @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[]
github thx / rap2-delos / src / models / bo / repository.ts View on Github external
creatorId: number

  @ForeignKey(() => User)
  @Column
  lockerId: number

  @BelongsTo(() => User, 'creatorId')
  creator: User

  @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[]
github thx / rap2-delos / src / models / bo / logger.ts View on Github external
moduleId: number

  @ForeignKey(() => Interface)
  @Column
  interfaceId: number

  @BelongsTo(() => User, 'creatorId')
  creator: User

  @BelongsTo(() => User, 'userId')
  user: User

  @BelongsTo(() => Repository, 'repositoryId')
  repository: Repository

  @BelongsTo(() => Organization, 'organizationId')
  organization: Organization

  @BelongsTo(() => Module, 'moduleId')
  module: Module

  @BelongsTo(() => Interface, 'interfaceId')
  interface: Interface

}
github thx / rap2-delos / src / models / bo / logger.ts View on Github external
@Column
  interfaceId: number

  @BelongsTo(() => User, 'creatorId')
  creator: User

  @BelongsTo(() => User, 'userId')
  user: User

  @BelongsTo(() => Repository, 'repositoryId')
  repository: Repository

  @BelongsTo(() => Organization, 'organizationId')
  organization: Organization

  @BelongsTo(() => Module, 'moduleId')
  module: Module

  @BelongsTo(() => Interface, 'interfaceId')
  interface: Interface

}
github birkir / prime / packages / prime-core / src / models / Webhook.ts View on Github external
@Column(DataType.UUID)
  public userId: any;

  @CreatedAt
  @Column
  public createdAt: Date;

  @UpdatedAt
  @Column
  public updatedAt: Date;

  @DeletedAt
  @Column
  public deletedAt: Date;

  @BelongsTo(() => User, 'userId')
  public user: User;
}