add: change implement enum and distribution
This commit is contained in:
		| @@ -1,23 +1,9 @@ | ||||
| import { | ||||
|   Entity, | ||||
|   Column, | ||||
|   PrimaryGeneratedColumn, | ||||
|   UpdateDateColumn, | ||||
|   DeleteDateColumn, | ||||
|   VersionColumn, | ||||
|   CreateDateColumn, | ||||
|   ManyToOne, | ||||
|   ManyToMany, | ||||
|   JoinTable, | ||||
| } from 'typeorm'; | ||||
| import { Product } from '../../product/entities/product.entity'; | ||||
| import { User } from '../../users/entities/user.entity'; | ||||
| import { BaseModel } from '../../config/basemodel.entity'; | ||||
|  | ||||
| enum balanceType { | ||||
|   DEBIT, | ||||
|   CREDIT, | ||||
| } | ||||
| import { balanceType } from '../../helper/enum-list'; | ||||
|  | ||||
| @Entity() | ||||
| export class CoaType extends BaseModel { | ||||
| @@ -26,8 +12,4 @@ export class CoaType extends BaseModel { | ||||
|  | ||||
|   @Column('text') | ||||
|   normalBalance: balanceType; | ||||
|  | ||||
|   @ManyToMany(() => User) | ||||
|   @JoinTable() | ||||
|   user: User[]; | ||||
| } | ||||
|   | ||||
| @@ -1,28 +1,9 @@ | ||||
| import { | ||||
|   Entity, | ||||
|   Column, | ||||
|   PrimaryGeneratedColumn, | ||||
|   UpdateDateColumn, | ||||
|   DeleteDateColumn, | ||||
|   VersionColumn, | ||||
|   CreateDateColumn, | ||||
|   ManyToOne, | ||||
|   ManyToMany, | ||||
|   JoinTable, | ||||
| } from 'typeorm'; | ||||
| import { Product } from '../../product/entities/product.entity'; | ||||
| import { User } from '../../users/entities/user.entity'; | ||||
| import { BaseModel } from '../../config/basemodel.entity'; | ||||
|  | ||||
| enum type { | ||||
|   SYSTEM_BANk, | ||||
|   INCOME, | ||||
| } | ||||
|  | ||||
| enum balanceType { | ||||
|   DEBIT, | ||||
|   CREDIT, | ||||
| } | ||||
| import { coaType, balanceType } from '../../helper/enum-list'; | ||||
|  | ||||
| @Entity() | ||||
| export class COA extends BaseModel { | ||||
| @@ -30,7 +11,7 @@ export class COA extends BaseModel { | ||||
|   name: string; | ||||
|  | ||||
|   @Column('text') | ||||
|   type: type; | ||||
|   type: coaType; | ||||
|  | ||||
|   @Column('text') | ||||
|   balanceType: balanceType; | ||||
| @@ -38,7 +19,6 @@ export class COA extends BaseModel { | ||||
|   @Column() | ||||
|   amount: number; | ||||
|  | ||||
|   @ManyToMany(() => User) | ||||
|   @JoinTable() | ||||
|   user: User[]; | ||||
|   @Column() | ||||
|   user: string; | ||||
| } | ||||
|   | ||||
| @@ -1,44 +1,52 @@ | ||||
| import { | ||||
|   Entity, | ||||
|   Column, | ||||
|   PrimaryGeneratedColumn, | ||||
|   UpdateDateColumn, | ||||
|   DeleteDateColumn, | ||||
|   VersionColumn, | ||||
|   CreateDateColumn, ManyToOne, ManyToMany, JoinTable, OneToOne, | ||||
|   ManyToOne, | ||||
|   ManyToMany, | ||||
|   JoinTable, | ||||
|   OneToOne, | ||||
| } from 'typeorm'; | ||||
| import { Product } from '../../product/entities/product.entity'; | ||||
| import { User } from '../../users/entities/user.entity'; | ||||
| import { BaseModel } from '../../config/basemodel.entity'; | ||||
| import { ProductCategories } from '../../product/entities/product-category.entity'; | ||||
| import { COA } from './coa.entity'; | ||||
| import { Transactions } from './transactions.entity'; | ||||
| import { TransactionType } from './transaction-type.entity'; | ||||
|  | ||||
| enum type { | ||||
|   SYSTEM_BANk, | ||||
|   INCOME, | ||||
| } | ||||
|  | ||||
| enum balanceType { | ||||
|   DEBIT, | ||||
|   CREDIT, | ||||
| } | ||||
| import { balanceType } from '../../helper/enum-list'; | ||||
|  | ||||
| @Entity() | ||||
| export class TransactionJournal extends BaseModel { | ||||
|   @Column('text') | ||||
|   type: type; | ||||
|   type: balanceType; | ||||
|  | ||||
|   @Column() | ||||
|   amount: number; | ||||
|  | ||||
|   @OneToOne(() => Transactions, (trans) => trans.id) | ||||
|   @OneToOne( | ||||
|     () => { | ||||
|       return Transactions; | ||||
|     }, | ||||
|     (trans) => { | ||||
|       return trans.id; | ||||
|     }, | ||||
|   ) | ||||
|   transaction: Transactions; | ||||
|  | ||||
|   @ManyToOne(() => COA, (coa) => coa.id) | ||||
|   @ManyToOne( | ||||
|     () => { | ||||
|       return COA; | ||||
|     }, | ||||
|     (coa) => { | ||||
|       return coa.id; | ||||
|     }, | ||||
|   ) | ||||
|   coa: COA; | ||||
|  | ||||
|   @ManyToOne(() => TransactionType, (transType) => transType.id) | ||||
|   @ManyToOne( | ||||
|     () => { | ||||
|       return TransactionType; | ||||
|     }, | ||||
|     (transType) => { | ||||
|       return transType.id; | ||||
|     }, | ||||
|   ) | ||||
|   transactionType: TransactionType; | ||||
| } | ||||
|   | ||||
| @@ -10,17 +10,8 @@ import { | ||||
|   ManyToMany, | ||||
|   JoinTable, | ||||
| } from 'typeorm'; | ||||
| import { Product } from '../../product/entities/product.entity'; | ||||
| import { User } from '../../users/entities/user.entity'; | ||||
| import { BaseModel } from '../../config/basemodel.entity'; | ||||
| import { COA } from './coa.entity'; | ||||
| import { ProductHistoryPrice } from '../../product/entities/product-history-price.entity'; | ||||
|  | ||||
| enum status { | ||||
|   PENDING, | ||||
|   SUCCESS, | ||||
|   FAILED, | ||||
| } | ||||
| import { statusTransaction, typeTransaction } from '../../helper/enum-list'; | ||||
|  | ||||
| @Entity() | ||||
| export class Transactions extends BaseModel { | ||||
| @@ -28,8 +19,16 @@ export class Transactions extends BaseModel { | ||||
|   amount: number; | ||||
|  | ||||
|   @Column() | ||||
|   status: status; | ||||
|   status: statusTransaction; | ||||
|  | ||||
|   @ManyToOne(() => User, (user) => user.id) | ||||
|   user: User; | ||||
|   @Column() | ||||
|   type: typeTransaction; | ||||
|  | ||||
|   @Column() | ||||
|   user: string; | ||||
|  | ||||
|   @Column({ | ||||
|     nullable: true, | ||||
|   }) | ||||
|   userDestination: string; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user