From 7475b83179b7460d9b670015c0f07f2ea5eae435 Mon Sep 17 00:00:00 2001 From: Dennis Postma Date: Thu, 11 Jul 2024 19:57:52 +0200 Subject: [PATCH] Ah --- Dockerfile | 9 ++--- src/app/repositories/TileTagRepository.ts | 45 ----------------------- 2 files changed, 4 insertions(+), 50 deletions(-) delete mode 100644 src/app/repositories/TileTagRepository.ts diff --git a/Dockerfile b/Dockerfile index 60f59e2..f1c6c24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,24 +10,23 @@ COPY package*.json ./ # Install application dependencies RUN npm install -# Copy the rest of your application code to the container -COPY . . - # Copy prisma schema COPY prisma ./prisma/ # Generate Prisma client RUN npx prisma generate +# Copy the rest of your application code to the container +COPY . . + # Build the application RUN npm run build # Expose the port your Node.js application will listen on EXPOSE 80 -# Create a shell script to run migrations, regenerate Prisma client, and start the application +# Create a shell script to run migrations and start the application RUN echo '#!/bin/sh' > /usr/src/app/start.sh && \ - echo 'npx prisma generate' >> /usr/src/app/start.sh && \ echo 'npx prisma migrate deploy' >> /usr/src/app/start.sh && \ echo 'node dist/server.js' >> /usr/src/app/start.sh && \ chmod +x /usr/src/app/start.sh diff --git a/src/app/repositories/TileTagRepository.ts b/src/app/repositories/TileTagRepository.ts deleted file mode 100644 index 34b7d20..0000000 --- a/src/app/repositories/TileTagRepository.ts +++ /dev/null @@ -1,45 +0,0 @@ -import prisma from '../utilities/Prisma'; // Import the global Prisma instance -import { TileTag } from '@prisma/client' - -class TileTagRepository { - async upsertTileTag(tile: string, tags: string[]): Promise { - return prisma.tileTag.upsert({ - where: { tile }, - create: { - tile, - tags: tags, - }, - update: { - tags: tags, - }, - }); - } - - async getTileTag(tile: string): Promise { - return prisma.tileTag.findUnique({ - where: { tile }, - }); - } - - async deleteTileTag(tile: string): Promise { - return prisma.tileTag.delete({ - where: { tile }, - }); - } - - async searchTilesByTags(tags: string[]): Promise { - return prisma.tileTag.findMany({ - where: { - tags: { - array_contains: tags, - } as any, // Type assertion needed due to Json field - }, - }); - } - - async getAllTileTags(): Promise { - return prisma.tileTag.findMany(); - } -} - -export default new TileTagRepository(); \ No newline at end of file