update brizzi
This commit is contained in:
48
src/entity/brilink_merchant_sites.ts
Normal file
48
src/entity/brilink_merchant_sites.ts
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from 'typeorm';
|
||||||
|
|
||||||
|
import { Status } from '../types/status';
|
||||||
|
import { BrilinkMerchantStatus } from '../types/brilink';
|
||||||
|
import { BrilinkMerchant } from './brilink_merchants';
|
||||||
|
|
||||||
|
@Entity('brilink_merchant_sites', { schema: 'brilinks' })
|
||||||
|
export class BrilinkMerchantSite {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => BrilinkMerchant, { onDelete: 'RESTRICT' })
|
||||||
|
@JoinTable()
|
||||||
|
merchant: BrilinkMerchant
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 4096
|
||||||
|
})
|
||||||
|
location: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
63
src/entity/brilink_merchant_terminal_histories.ts
Normal file
63
src/entity/brilink_merchant_terminal_histories.ts
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, JoinTable } from 'typeorm';
|
||||||
|
|
||||||
|
import { Status } from '../types/status';
|
||||||
|
import { BrilinkMerchantStatus, BrilinkTerminalCondition } from '../types/brilink';
|
||||||
|
import { BrilinkMerchant } from './brilink_merchants';
|
||||||
|
import { BrilinkMerchantSite } from './brilink_merchant_sites';
|
||||||
|
import { BrilinkTerminal } from './brilink_terminals';
|
||||||
|
|
||||||
|
@Entity('brilink_merchant_terminal_histories', { schema: 'brilinks' })
|
||||||
|
export class BrilinkMerchantTerminalHistory {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => BrilinkMerchant, { onDelete: 'RESTRICT' })
|
||||||
|
@JoinTable()
|
||||||
|
merchant: BrilinkMerchant
|
||||||
|
|
||||||
|
@ManyToOne(() => BrilinkTerminal, { onDelete: 'RESTRICT' })
|
||||||
|
@JoinTable()
|
||||||
|
terminal: BrilinkTerminal
|
||||||
|
|
||||||
|
@ManyToOne(() => BrilinkMerchantSite, { onDelete: 'RESTRICT' })
|
||||||
|
@JoinTable()
|
||||||
|
site: BrilinkMerchantSite
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 1096
|
||||||
|
})
|
||||||
|
note: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
length: 1096
|
||||||
|
})
|
||||||
|
condition: BrilinkTerminalCondition;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
34
src/entity/brilink_merchant_terminal_menus.ts
Normal file
34
src/entity/brilink_merchant_terminal_menus.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, JoinColumn, ManyToOne, ManyToMany, JoinTable } from 'typeorm';
|
||||||
|
|
||||||
|
import { Status } from '../types/status';
|
||||||
|
import { Application } from './application';
|
||||||
|
import { User } from './users';
|
||||||
|
import { BrilinkMerchantTerminal } from './brilink_merchant_terminals';
|
||||||
|
|
||||||
|
@Entity('brilink_merchant_terminal_menus', { schema: 'brilinks' })
|
||||||
|
export class BrilinkMerchantTerminalMenu {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => BrilinkMerchantTerminal, { onDelete: 'CASCADE' })
|
||||||
|
@JoinTable()
|
||||||
|
merchant_terminal: BrilinkMerchantTerminal
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'jsonb'
|
||||||
|
})
|
||||||
|
menus: string[];
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
}
|
||||||
64
src/entity/brilink_merchant_terminal_user_refresh_token.ts
Normal file
64
src/entity/brilink_merchant_terminal_user_refresh_token.ts
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import { Column, CreateDateColumn, DeleteDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
||||||
|
|
||||||
|
@Entity('brilink_terminal_user_refresh_tokens', { schema: 'brilinks' })
|
||||||
|
export class BrilinkTerminalUserRefreshToken {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
refresh_token: string;
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({
|
||||||
|
type: 'uuid'
|
||||||
|
})
|
||||||
|
id_user: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 4096,
|
||||||
|
})
|
||||||
|
user_agent: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 128
|
||||||
|
})
|
||||||
|
os: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
device: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
platform: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
browser: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 32
|
||||||
|
})
|
||||||
|
remote_addr: string;
|
||||||
|
|
||||||
|
@Column('timestamp')
|
||||||
|
expired_at: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
}
|
||||||
95
src/entity/brilink_merchant_terminal_users.ts
Normal file
95
src/entity/brilink_merchant_terminal_users.ts
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
import bcrypt from 'bcryptjs';
|
||||||
|
import { Column, CreateDateColumn, DeleteDateColumn, Entity, Index, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
||||||
|
|
||||||
|
import { Status } from '../types/status';
|
||||||
|
import { BrilinkMerchantTerminal } from './brilink_merchant_terminals';
|
||||||
|
|
||||||
|
@Entity('brilink_merchant_terminal_users', { schema: 'brilinks' })
|
||||||
|
export class BrilinkMerchantTerminalUser {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
email: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64,
|
||||||
|
select: false
|
||||||
|
})
|
||||||
|
password: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
username: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
pin: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
authenticator: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 64,
|
||||||
|
unique: false,
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => BrilinkMerchantTerminal, { onDelete: 'CASCADE' })
|
||||||
|
@JoinTable()
|
||||||
|
merchant_terminal: BrilinkMerchantTerminal
|
||||||
|
|
||||||
|
@Index()
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'uuid',
|
||||||
|
select: false
|
||||||
|
})
|
||||||
|
reset_token: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
status: Status;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
hashPassword() {
|
||||||
|
this.password = bcrypt.hashSync(this.password, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
hashPin() {
|
||||||
|
this.pin = bcrypt.hashSync(this.pin, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkIfPasswordMatch(unencryptedPassword: string) {
|
||||||
|
return bcrypt.compareSync(unencryptedPassword, this.password);
|
||||||
|
}
|
||||||
|
}
|
||||||
57
src/entity/brilink_merchant_terminals.ts
Normal file
57
src/entity/brilink_merchant_terminals.ts
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
||||||
|
|
||||||
|
import { BrilinkTerminalOnline } from '../types/brilink';
|
||||||
|
import { BrilinkMerchant } from './brilink_merchants';
|
||||||
|
import { BrilinkMerchantSite } from './brilink_merchant_sites';
|
||||||
|
import { BrilinkTerminal } from './brilink_terminals';
|
||||||
|
|
||||||
|
@Entity('brilink_merchant_terminals', { schema: 'brilinks' })
|
||||||
|
export class BrilinkMerchantTerminal {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => BrilinkMerchant, { onDelete: 'RESTRICT' })
|
||||||
|
@JoinTable()
|
||||||
|
merchant: BrilinkMerchant
|
||||||
|
|
||||||
|
@ManyToOne(() => BrilinkMerchantSite, { onDelete: 'RESTRICT' })
|
||||||
|
@JoinTable()
|
||||||
|
site: BrilinkMerchantSite
|
||||||
|
|
||||||
|
@ManyToOne(() => BrilinkTerminal, { onDelete: 'RESTRICT' })
|
||||||
|
@JoinTable()
|
||||||
|
terminal: BrilinkTerminal
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
status: BrilinkTerminalOnline;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
101
src/entity/brilink_merchants.ts
Normal file
101
src/entity/brilink_merchants.ts
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from 'typeorm';
|
||||||
|
|
||||||
|
import { Status } from '../types/status';
|
||||||
|
import { BrilinkMerchantStatus } from '../types/brilink';
|
||||||
|
|
||||||
|
@Entity('brilink_merchants', { schema: 'brilinks' })
|
||||||
|
export class BrilinkMerchant {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 4096
|
||||||
|
})
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 4096
|
||||||
|
})
|
||||||
|
address: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
phone: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 4096
|
||||||
|
})
|
||||||
|
logo: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
status: BrilinkMerchantStatus;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
account_number: string
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
account_holder: string
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
pic_name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
pic_phone: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
pic_email: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
65
src/entity/brilink_terminal_menus.ts
Normal file
65
src/entity/brilink_terminal_menus.ts
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import { Column, CreateDateColumn, DeleteDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
||||||
|
|
||||||
|
import { Status } from '../types/status';
|
||||||
|
|
||||||
|
@Entity('brilink_terminal_menus', { schema: 'brilinks' })
|
||||||
|
export class BrilinkTerminalMenu {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 128
|
||||||
|
})
|
||||||
|
module: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 128
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
link: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'uuid'
|
||||||
|
})
|
||||||
|
id_parent: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'int2'
|
||||||
|
})
|
||||||
|
order_number: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 128
|
||||||
|
})
|
||||||
|
icon: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
status: Status;
|
||||||
|
|
||||||
|
children: BrilinkTerminalMenu[]
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
}
|
||||||
74
src/entity/brilink_terminals.ts
Normal file
74
src/entity/brilink_terminals.ts
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from 'typeorm';
|
||||||
|
|
||||||
|
import { Status } from '../types/status';
|
||||||
|
import { BrilinkTerminalCondition, BrilinkTerminalType } from '../types/brilink';
|
||||||
|
|
||||||
|
@Entity('brilink_terminals', { schema: 'brilinks' })
|
||||||
|
export class BrilinkTerminal {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
type: BrilinkTerminalType;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
brand: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
model: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
serial: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 4096
|
||||||
|
})
|
||||||
|
notes: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
condition: BrilinkTerminalCondition;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
status: Status;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
96
src/entity/brizzi_batchs.ts
Normal file
96
src/entity/brizzi_batchs.ts
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
import { Column, CreateDateColumn, DeleteDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
||||||
|
|
||||||
|
import { BrizziBatchStatus, BrizziCardStatus } from '../types/brizzi';
|
||||||
|
|
||||||
|
@Entity('brizzi_batchs', { schema: 'brizzis' })
|
||||||
|
export class BrizziBatch {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
brand: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
model: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
code_start: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
code_end: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: 'int2',
|
||||||
|
nullable: true,
|
||||||
|
default: 0
|
||||||
|
})
|
||||||
|
quantity: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
file: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
})
|
||||||
|
import_at: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
finish_at: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 4096
|
||||||
|
})
|
||||||
|
remarks: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
status: BrizziBatchStatus;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
82
src/entity/brizzi_cards.ts
Normal file
82
src/entity/brizzi_cards.ts
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
||||||
|
|
||||||
|
import { BrizziCardStatus } from '../types/brizzi';
|
||||||
|
import { BrizziBatch } from './brizzi_batchs';
|
||||||
|
|
||||||
|
@Entity('brizzi_cards', { schema: 'brizzis' })
|
||||||
|
export class BrizziCard {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => BrizziBatch, { onDelete: 'RESTRICT' })
|
||||||
|
@JoinTable()
|
||||||
|
batch: BrizziBatch;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
brand: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
model: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
unique: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
uid: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 4096
|
||||||
|
})
|
||||||
|
notes: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: 'float8',
|
||||||
|
nullable: false,
|
||||||
|
default: 0
|
||||||
|
})
|
||||||
|
balance: number;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
balance_at: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
status: BrizziCardStatus;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
79
src/entity/brizzi_history.ts
Normal file
79
src/entity/brizzi_history.ts
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
import { Column, CreateDateColumn, DeleteDateColumn, Entity, JoinTable, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
||||||
|
|
||||||
|
import { BrizziHistoryActvity, BrizziHistoryType } from '../types/brizzi';
|
||||||
|
import { BrilinkTerminal } from './brilink_terminals';
|
||||||
|
import { BrizziCard } from './brizzi_cards';
|
||||||
|
|
||||||
|
@Entity('brizzi_histories', { schema: 'brizzis' })
|
||||||
|
export class BrizziHistory {
|
||||||
|
@PrimaryGeneratedColumn('uuid')
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => BrizziCard, { onDelete: 'RESTRICT' })
|
||||||
|
@JoinTable()
|
||||||
|
card: BrizziCard
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
activity: BrizziHistoryActvity;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
activity_at: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 64
|
||||||
|
})
|
||||||
|
type: BrizziHistoryType;
|
||||||
|
|
||||||
|
@ManyToOne(() => BrilinkTerminal, { onDelete: 'RESTRICT', nullable: true })
|
||||||
|
@JoinTable()
|
||||||
|
terminal: BrilinkTerminal
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
length: 128,
|
||||||
|
nullable: false,
|
||||||
|
})
|
||||||
|
reference: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: 'float8',
|
||||||
|
nullable: false,
|
||||||
|
})
|
||||||
|
prev_balance: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: 'float8',
|
||||||
|
nullable: false,
|
||||||
|
})
|
||||||
|
amount: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
type: 'float8',
|
||||||
|
nullable: false,
|
||||||
|
})
|
||||||
|
last_balance: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
@CreateDateColumn()
|
||||||
|
created_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255 })
|
||||||
|
created_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@UpdateDateColumn()
|
||||||
|
updated_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
updated_by: string;
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@DeleteDateColumn()
|
||||||
|
deleted_at: Date;
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
|
deleted_by: string;
|
||||||
|
}
|
||||||
35
src/index.ts
35
src/index.ts
@ -88,6 +88,24 @@ import { RemitTransfer } from "./entity/remit_tansfer";
|
|||||||
import { RemitTopup } from "./entity/remit_topup";
|
import { RemitTopup } from "./entity/remit_topup";
|
||||||
import { RemitMutation } from "./entity/remit_mutation";
|
import { RemitMutation } from "./entity/remit_mutation";
|
||||||
|
|
||||||
|
import { BrizziBatchStatus, BrizziCardStatus, BrizziHistoryActvity, BrizziHistoryType } from './types/brizzi'
|
||||||
|
import { BrizziBatch } from './entity/brizzi_batchs'
|
||||||
|
import { BrizziCard } from './entity/brizzi_cards'
|
||||||
|
import { BrizziHistory } from './entity/brizzi_history'
|
||||||
|
|
||||||
|
import { BrilinkMerchantStatus, BrilinkTerminalType, BrilinkTerminalCondition, BrilinkTerminalOnline } from './types/brilink'
|
||||||
|
import { BrilinkMerchant } from './entity/brilink_merchants'
|
||||||
|
import { BrilinkTerminal } from './entity/brilink_terminals'
|
||||||
|
import { BrilinkTerminalMenu } from './entity/brilink_terminal_menus'
|
||||||
|
import { BrilinkMerchantSite } from './entity/brilink_merchant_sites'
|
||||||
|
import { BrilinkMerchantTerminal } from './entity/brilink_merchant_terminals'
|
||||||
|
import { BrilinkMerchantTerminalHistory } from './entity/brilink_merchant_terminal_histories'
|
||||||
|
import { BrilinkMerchantTerminalMenu } from './entity/brilink_merchant_terminal_menus'
|
||||||
|
import { BrilinkMerchantTerminalUser } from './entity/brilink_merchant_terminal_users'
|
||||||
|
import { BrilinkTerminalUserRefreshToken } from './entity/brilink_merchant_terminal_user_refresh_token'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
User, //
|
User, //
|
||||||
UserRole,
|
UserRole,
|
||||||
@ -185,4 +203,21 @@ export {
|
|||||||
RemitTransfer,
|
RemitTransfer,
|
||||||
RemitTopup,
|
RemitTopup,
|
||||||
RemitMutation,
|
RemitMutation,
|
||||||
|
|
||||||
|
BrizziBatchStatus, BrizziCardStatus, BrizziHistoryActvity, BrizziHistoryType,
|
||||||
|
BrizziBatch,
|
||||||
|
BrizziCard,
|
||||||
|
BrizziHistory,
|
||||||
|
|
||||||
|
BrilinkMerchantStatus, BrilinkTerminalType, BrilinkTerminalCondition, BrilinkTerminalOnline,
|
||||||
|
BrilinkMerchant,
|
||||||
|
BrilinkTerminal,
|
||||||
|
BrilinkTerminalMenu,
|
||||||
|
BrilinkMerchantSite,
|
||||||
|
BrilinkMerchantTerminal,
|
||||||
|
BrilinkMerchantTerminalHistory,
|
||||||
|
BrilinkMerchantTerminalMenu,
|
||||||
|
BrilinkMerchantTerminalUser,
|
||||||
|
BrilinkTerminalUserRefreshToken,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
23
src/types/brilink.ts
Normal file
23
src/types/brilink.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
export enum BrilinkMerchantStatus {
|
||||||
|
"active" = "active",
|
||||||
|
"inactive" = "inactive",
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum BrilinkTerminalType {
|
||||||
|
"edc" = "edc",
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum BrilinkTerminalCondition {
|
||||||
|
"new" = "new",
|
||||||
|
"good" = "good",
|
||||||
|
"minor_damage" = "minor_damage",
|
||||||
|
"damaged" = "damaged",
|
||||||
|
"unusabel" = "unusable",
|
||||||
|
"disposed" = "disposed",
|
||||||
|
"lost" = "lost",
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum BrilinkTerminalOnline {
|
||||||
|
"online" = "online",
|
||||||
|
"offline" = "offline"
|
||||||
|
}
|
||||||
24
src/types/brizzi.ts
Normal file
24
src/types/brizzi.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
export enum BrizziBatchStatus {
|
||||||
|
"queue" = "queue",
|
||||||
|
"process" = "process",
|
||||||
|
"success" = "success",
|
||||||
|
"failed" = "failed",
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum BrizziCardStatus {
|
||||||
|
"active" = "active",
|
||||||
|
"inactive" = "inactive",
|
||||||
|
"blocked" = "blocked",
|
||||||
|
};
|
||||||
|
|
||||||
|
export enum BrizziHistoryActvity {
|
||||||
|
"active" = "active",
|
||||||
|
"topup" = "topup",
|
||||||
|
"payment" = "payment",
|
||||||
|
"blocked" = "blocked"
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum BrizziHistoryType {
|
||||||
|
"credit" = "credit",
|
||||||
|
"debit" = "debit",
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user