Add business registration requests with approval flow, SMS notifications, and owner businesses endpoint.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-23 18:13:09 +03:30
co-authored by Cursor
parent 97a9ee022f
commit aa990c3204
14 changed files with 611 additions and 3 deletions
@@ -0,0 +1,92 @@
import {
Column,
CreateDateColumn,
Entity,
JoinColumn,
ManyToOne,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { BusinessCategoryEntity } from './business-category.entity';
import { BusinessEntity } from './business.entity';
import { UserEntity } from './user.entity';
export enum BusinessRegistrationStatus {
PENDING = 'pending',
APPROVED = 'approved',
REJECTED = 'rejected',
}
@Entity('business_registration_requests')
export class BusinessRegistrationRequestEntity {
@PrimaryGeneratedColumn('uuid')
id!: string;
@ManyToOne(() => UserEntity, { onDelete: 'CASCADE' })
@JoinColumn({ name: 'applicantId' })
applicant!: UserEntity;
@Column('uuid')
applicantId!: string;
@Column({
type: 'varchar',
length: 20,
default: BusinessRegistrationStatus.PENDING,
})
status!: BusinessRegistrationStatus;
@Column({ length: 150 })
title!: string;
@Column({ length: 120 })
slug!: string;
@ManyToOne(() => BusinessCategoryEntity, { onDelete: 'RESTRICT' })
@JoinColumn({ name: 'categoryId' })
category!: BusinessCategoryEntity;
@Column('uuid')
categoryId!: string;
@Column({ type: 'varchar', nullable: true, length: 500 })
description!: string | null;
@Column({ type: 'varchar', nullable: true, length: 20 })
contactPhone!: string | null;
@Column({ type: 'varchar', nullable: true, length: 500 })
address!: string | null;
@Column({ type: 'double precision', nullable: true })
latitude!: number | null;
@Column({ type: 'double precision', nullable: true })
longitude!: number | null;
@Column({ type: 'varchar', nullable: true, length: 500 })
adminNote!: string | null;
@ManyToOne(() => UserEntity, { nullable: true, onDelete: 'SET NULL' })
@JoinColumn({ name: 'reviewedById' })
reviewedBy!: UserEntity | null;
@Column({ type: 'uuid', nullable: true })
reviewedById!: string | null;
@Column({ type: 'timestamptz', nullable: true })
reviewedAt!: Date | null;
@ManyToOne(() => BusinessEntity, { nullable: true, onDelete: 'SET NULL' })
@JoinColumn({ name: 'businessId' })
business!: BusinessEntity | null;
@Column({ type: 'uuid', nullable: true })
businessId!: string | null;
@CreateDateColumn()
createdAt!: Date;
@UpdateDateColumn()
updatedAt!: Date;
}