27 lines
899 B
TypeScript
27 lines
899 B
TypeScript
import { Entity, Enum, Index, ManyToOne, Property } from '@mikro-orm/core';
|
|
import { BaseEntity } from '../../../common/entities/base.entity';
|
|
import { Restaurant } from './restaurant.entity';
|
|
import {
|
|
RestaurantCreditTransactionReason,
|
|
RestaurantCreditTransactionType,
|
|
} from '../interface/restaurant-credit-transaction.interface';
|
|
|
|
@Entity({ tableName: 'restaurant_credit_transactions' })
|
|
@Index({ properties: ['restaurant'] })
|
|
export class RestaurantCreditTransaction extends BaseEntity {
|
|
@ManyToOne(() => Restaurant)
|
|
restaurant!: Restaurant;
|
|
|
|
@Property({ type: 'decimal', precision: 10, scale: 0 })
|
|
amount!: number;
|
|
|
|
@Property({ type: 'decimal', precision: 10, scale: 0 })
|
|
balance!: number;
|
|
|
|
@Enum(() => RestaurantCreditTransactionType)
|
|
type!: RestaurantCreditTransactionType;
|
|
|
|
@Enum(() => RestaurantCreditTransactionReason)
|
|
reason!: RestaurantCreditTransactionReason;
|
|
}
|