forked from noxious/server
Ah
This commit is contained in:
parent
218ac385dd
commit
7475b83179
@ -10,24 +10,23 @@ COPY package*.json ./
|
|||||||
# Install application dependencies
|
# Install application dependencies
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
# Copy the rest of your application code to the container
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Copy prisma schema
|
# Copy prisma schema
|
||||||
COPY prisma ./prisma/
|
COPY prisma ./prisma/
|
||||||
|
|
||||||
# Generate Prisma client
|
# Generate Prisma client
|
||||||
RUN npx prisma generate
|
RUN npx prisma generate
|
||||||
|
|
||||||
|
# Copy the rest of your application code to the container
|
||||||
|
COPY . .
|
||||||
|
|
||||||
# Build the application
|
# Build the application
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Expose the port your Node.js application will listen on
|
# Expose the port your Node.js application will listen on
|
||||||
EXPOSE 80
|
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 && \
|
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 'npx prisma migrate deploy' >> /usr/src/app/start.sh && \
|
||||||
echo 'node dist/server.js' >> /usr/src/app/start.sh && \
|
echo 'node dist/server.js' >> /usr/src/app/start.sh && \
|
||||||
chmod +x /usr/src/app/start.sh
|
chmod +x /usr/src/app/start.sh
|
||||||
|
@ -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<TileTag> {
|
|
||||||
return prisma.tileTag.upsert({
|
|
||||||
where: { tile },
|
|
||||||
create: {
|
|
||||||
tile,
|
|
||||||
tags: tags,
|
|
||||||
},
|
|
||||||
update: {
|
|
||||||
tags: tags,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async getTileTag(tile: string): Promise<TileTag | null> {
|
|
||||||
return prisma.tileTag.findUnique({
|
|
||||||
where: { tile },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async deleteTileTag(tile: string): Promise<TileTag> {
|
|
||||||
return prisma.tileTag.delete({
|
|
||||||
where: { tile },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async searchTilesByTags(tags: string[]): Promise<TileTag[]> {
|
|
||||||
return prisma.tileTag.findMany({
|
|
||||||
where: {
|
|
||||||
tags: {
|
|
||||||
array_contains: tags,
|
|
||||||
} as any, // Type assertion needed due to Json field
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async getAllTileTags(): Promise<TileTag[]> {
|
|
||||||
return prisma.tileTag.findMany();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default new TileTagRepository();
|
|
Loading…
x
Reference in New Issue
Block a user