tipsEnabled

This commit is contained in:
2026-06-29 19:31:26 +03:30
parent 2ba959b3ae
commit 3844594506
14 changed files with 479 additions and 2 deletions
+53
View File
@@ -0,0 +1,53 @@
import {
Column,
CreateDateColumn,
Entity,
JoinColumn,
ManyToOne,
PrimaryGeneratedColumn,
} from 'typeorm';
import { BookingEntity } from './booking.entity';
import { BusinessEntity } from './business.entity';
import { UserEntity } from './user.entity';
@Entity('booking_reviews')
export class BookingReviewEntity {
@PrimaryGeneratedColumn('uuid')
id!: string;
@ManyToOne(() => BookingEntity, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'bookingId' })
booking!: BookingEntity;
@Column({ type: 'uuid', unique: true })
bookingId!: string;
@ManyToOne(() => UserEntity, { onDelete: 'RESTRICT' })
@JoinColumn({ name: 'customerId' })
customer!: UserEntity;
@Column('uuid')
customerId!: string;
@ManyToOne(() => BusinessEntity, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'businessId' })
business!: BusinessEntity;
@Column('uuid')
businessId!: string;
@Column({ type: 'int' })
rating!: number;
@Column({ type: 'decimal', precision: 12, scale: 0, nullable: true })
tipAmount!: string | null;
@Column({ default: false })
tipPaid!: boolean;
@Column({ type: 'varchar', nullable: true, length: 64 })
tipAuthority!: string | null;
@CreateDateColumn()
createdAt!: Date;
}
+6
View File
@@ -80,6 +80,12 @@ export class BookingEntity {
@Column({ type: 'varchar', nullable: true, length: 64 })
paymentAuthority!: string | null;
@Column({ type: 'timestamptz', nullable: true })
completedAt!: Date | null;
@Column({ type: 'timestamptz', nullable: true })
reviewPromptedAt!: Date | null;
@CreateDateColumn()
createdAt!: Date;
+4
View File
@@ -62,6 +62,10 @@ export class BusinessEntity {
@Column({ default: false })
autoApproveBookings!: boolean;
/** When true, customers can leave an optional gratuity after rating a completed booking. */
@Column({ default: false })
tipsEnabled!: boolean;
@ManyToOne(() => BusinessCategoryEntity, (category) => category.businesses, {
onDelete: 'RESTRICT',
})