Move software files one directory up, Readme
This commit is contained in:
47
backend/models/user/account.model.ts
Normal file
47
backend/models/user/account.model.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { Table, Column, Model, HasMany, Unique, BelongsTo, ForeignKey } from 'sequelize-typescript';
|
||||
import { Order } from '../ordering/order.model';
|
||||
import { Address } from './address.model';
|
||||
import { Payment } from './payment.model';
|
||||
import { AccountRole } from './accountRole.model';
|
||||
import { Rating } from '../acts/rating.model';
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Account extends Model {
|
||||
@Unique
|
||||
@Column
|
||||
username: string
|
||||
|
||||
@Column
|
||||
password: string
|
||||
|
||||
@Unique
|
||||
@Column
|
||||
email: string
|
||||
|
||||
@Column
|
||||
firstName: string = ""
|
||||
|
||||
@Column
|
||||
lastName: string = ""
|
||||
|
||||
@ForeignKey(() => AccountRole)
|
||||
@Column
|
||||
accountRoleId: number
|
||||
|
||||
|
||||
// Relations
|
||||
@HasMany(() => Address)
|
||||
addresses: Address[]
|
||||
|
||||
@HasMany(() => Payment)
|
||||
payments: Payment[]
|
||||
|
||||
@HasMany(() => Order)
|
||||
orders: Order[]
|
||||
|
||||
@HasMany(() => Rating)
|
||||
ratings: Rating[]
|
||||
|
||||
@BelongsTo(() => AccountRole)
|
||||
accountRole: AccountRole
|
||||
}
|
||||
22
backend/models/user/accountRole.model.ts
Normal file
22
backend/models/user/accountRole.model.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Column, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Account } from "./account.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class AccountRole extends Model {
|
||||
@Column
|
||||
name: string
|
||||
|
||||
@Column
|
||||
privilegeBuy: boolean
|
||||
|
||||
@Column
|
||||
privilegeAdminPanel: boolean
|
||||
|
||||
@Column
|
||||
privilegeFileAccess: boolean
|
||||
|
||||
|
||||
// Relations
|
||||
@HasMany(() => Account)
|
||||
accounts: Account[]
|
||||
}
|
||||
31
backend/models/user/address.model.ts
Normal file
31
backend/models/user/address.model.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Account } from "./account.model";
|
||||
import { Order } from "../ordering/order.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Address extends Model {
|
||||
@ForeignKey(() => Account)
|
||||
@Column
|
||||
accountId: number
|
||||
|
||||
@Column
|
||||
street: string
|
||||
|
||||
@Column
|
||||
houseNumber: number
|
||||
|
||||
@Column
|
||||
postalCode: number
|
||||
|
||||
@Column
|
||||
city: string
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => Account)
|
||||
account: Account
|
||||
|
||||
@HasMany(() => Order)
|
||||
orders: Order[]
|
||||
}
|
||||
25
backend/models/user/payment.model.ts
Normal file
25
backend/models/user/payment.model.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { BelongsTo, Column, ForeignKey, HasMany, Model, Table } from "sequelize-typescript";
|
||||
import { Account } from "./account.model";
|
||||
import { Order } from "../ordering/order.model";
|
||||
|
||||
@Table({ timestamps: false })
|
||||
export class Payment extends Model {
|
||||
@ForeignKey(() => Account)
|
||||
@Column
|
||||
accountId: number
|
||||
|
||||
@Column
|
||||
bankName: string
|
||||
|
||||
@Column
|
||||
iban: string
|
||||
|
||||
|
||||
// Relations
|
||||
|
||||
@BelongsTo(() => Account)
|
||||
account: Account
|
||||
|
||||
@HasMany(() => Order)
|
||||
orders: Order[]
|
||||
}
|
||||
Reference in New Issue
Block a user