feat: implement initial database schema and services for authentication, restaurants, categories, and menu items with image support.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Category" ADD COLUMN "image" TEXT;
|
||||
@@ -97,6 +97,7 @@ model Restaurant {
|
||||
model Category {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
image String?
|
||||
|
||||
restaurantId String
|
||||
restaurant Restaurant @relation(fields: [restaurantId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@ -18,6 +18,7 @@ export class CategoryService {
|
||||
const category = await this.prisma.category.create({
|
||||
data: {
|
||||
name: dto.name,
|
||||
image: dto.image,
|
||||
restaurantId: dto.restaurantId,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -81,9 +81,11 @@ export class ItemService {
|
||||
async remove(id: string, userId: string) {
|
||||
const item = await this.findOne(id);
|
||||
|
||||
return await this.restaurantService.verifyOwnership(
|
||||
await this.restaurantService.verifyOwnership(
|
||||
userId,
|
||||
item.restaurantId,
|
||||
);
|
||||
|
||||
return this.prisma.menuItem.delete({ where: { id } });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user