feat: implement initial database schema and services for authentication, restaurants, categories, and menu items with image support.

This commit is contained in:
2025-12-01 15:08:58 +03:00
parent 365dd603db
commit c6818e55ca
4 changed files with 7 additions and 1 deletions
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Category" ADD COLUMN "image" TEXT;
+1
View File
@@ -97,6 +97,7 @@ model Restaurant {
model Category { model Category {
id String @id @default(uuid()) id String @id @default(uuid())
name String name String
image String?
restaurantId String restaurantId String
restaurant Restaurant @relation(fields: [restaurantId], references: [id], onDelete: Cascade) restaurant Restaurant @relation(fields: [restaurantId], references: [id], onDelete: Cascade)
+1
View File
@@ -18,6 +18,7 @@ export class CategoryService {
const category = await this.prisma.category.create({ const category = await this.prisma.category.create({
data: { data: {
name: dto.name, name: dto.name,
image: dto.image,
restaurantId: dto.restaurantId, restaurantId: dto.restaurantId,
}, },
}); });
+3 -1
View File
@@ -81,9 +81,11 @@ export class ItemService {
async remove(id: string, userId: string) { async remove(id: string, userId: string) {
const item = await this.findOne(id); const item = await this.findOne(id);
return await this.restaurantService.verifyOwnership( await this.restaurantService.verifyOwnership(
userId, userId,
item.restaurantId, item.restaurantId,
); );
return this.prisma.menuItem.delete({ where: { id } });
} }
} }