brilink update
This commit is contained in:
64
src/entity/brilink_merchant_user_refresh_token.ts
Normal file
64
src/entity/brilink_merchant_user_refresh_token.ts
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import { Column, CreateDateColumn, DeleteDateColumn, Entity, Index, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
||||||
|
|
||||||
|
@Entity('brilink_merchant_user_refresh_tokens', { schema: 'brilinks' })
|
||||||
|
export class BrilinkMerchantUserRefreshToken {
|
||||||
|
@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;
|
||||||
|
}
|
||||||
85
src/entity/brilink_merchant_users.ts
Normal file
85
src/entity/brilink_merchant_users.ts
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
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';
|
||||||
|
import { BrilinkMerchant } from './brilink_merchants';
|
||||||
|
|
||||||
|
@Entity('brilink_merchant_users', { schema: 'brilinks' })
|
||||||
|
export class BrilinkMerchantUser {
|
||||||
|
@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: true,
|
||||||
|
length: 256
|
||||||
|
})
|
||||||
|
authenticator: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 64,
|
||||||
|
unique: false,
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => BrilinkMerchant, { onDelete: 'CASCADE' })
|
||||||
|
@JoinTable()
|
||||||
|
merchant: BrilinkMerchant
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkIfPasswordMatch(unencryptedPassword: string) {
|
||||||
|
return bcrypt.compareSync(unencryptedPassword, this.password);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -115,6 +115,8 @@ import {
|
|||||||
} from './types/brilink'
|
} from './types/brilink'
|
||||||
|
|
||||||
import { BrilinkMerchant } from './entity/brilink_merchants'
|
import { BrilinkMerchant } from './entity/brilink_merchants'
|
||||||
|
import { BrilinkMerchantUser } from './entity/brilink_merchant_users'
|
||||||
|
import { BrilinkMerchantUserRefreshToken } from './entity/brilink_merchant_user_refresh_token'
|
||||||
import { BrilinkTerminal } from './entity/brilink_terminals'
|
import { BrilinkTerminal } from './entity/brilink_terminals'
|
||||||
import { BrilinkTerminalMenu } from './entity/brilink_terminal_menus'
|
import { BrilinkTerminalMenu } from './entity/brilink_terminal_menus'
|
||||||
import { BrilinkMerchantSite } from './entity/brilink_merchant_sites'
|
import { BrilinkMerchantSite } from './entity/brilink_merchant_sites'
|
||||||
@ -247,6 +249,8 @@ export {
|
|||||||
|
|
||||||
BrilinkMerchantStatus, BrilinkTerminalType, BrilinkTerminalCondition, BrilinkTerminalOnline,
|
BrilinkMerchantStatus, BrilinkTerminalType, BrilinkTerminalCondition, BrilinkTerminalOnline,
|
||||||
BrilinkMerchant,
|
BrilinkMerchant,
|
||||||
|
BrilinkMerchantUser,
|
||||||
|
BrilinkMerchantUserRefreshToken,
|
||||||
BrilinkTerminal,
|
BrilinkTerminal,
|
||||||
BrilinkTerminalMenu,
|
BrilinkTerminalMenu,
|
||||||
BrilinkMerchantSite,
|
BrilinkMerchantSite,
|
||||||
|
|||||||
Reference in New Issue
Block a user