Skip to content

Commit ef7146d

Browse files
committed
update
1 parent af691b2 commit ef7146d

7 files changed

Lines changed: 16 additions & 14 deletions

File tree

Dockerfile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,8 @@ RUN chown appuser:appuser /app
5252
# Install runtime dependencies
5353
RUN apk add --no-cache git
5454

55-
# Copy package files for production install
56-
COPY --from=build --chown=appuser:appuser /app/package.json /app/pnpm-lock.yaml /app/pnpm-workspace.yaml ./
57-
58-
# Install only production dependencies
59-
RUN --mount=type=cache,id=pnpm-prod,target=/pnpm/store \
60-
pnpm config set store-dir /pnpm/store && \
61-
pnpm install --frozen-lockfile --prod --ignore-scripts
55+
# Copy node_modules from build stage (includes all Prisma dependencies)
56+
COPY --from=build --chown=appuser:appuser /app/node_modules ./node_modules
6257
ENV REDIS_URL="redis://redis:6379"
6358

6459
# Copy built application from build stage

prisma/schema.prisma

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
66

77
generator client {
8-
provider = "prisma-client-js"
8+
provider = "prisma-client"
99
output = "../src/generated/prisma"
10+
engineType = "client"
1011
}
1112

1213
datasource db {

src/common/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { WebSocketAdapter } from "../types";
22
import { ErrorResponseSchema, JoinResponseSchema, KDGlobalMessage, KDGlobalMessageSchema, OKResponseSchema, UploadCoreDump } from "../protobufs/kd_global_pb";
3-
import { PrismaClient } from "../generated/prisma";
3+
import { PrismaClient } from "../generated/prisma/client";
44
import { create, toBinary } from "@bufbuild/protobuf";
55
import { DeviceAPIMessageSchema } from "../protobufs/device-api_pb";
66
import { RedisConnection } from "../redis";

src/common/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DeviceType } from "../generated/prisma";
1+
import { DeviceType } from "../generated/prisma/enums";
22

33
// Type-specific settings
44
export type LanternSettings = {

src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@ import { WebSocketAdapter, UserData } from './types';
55
import { fromBinary } from '@bufbuild/protobuf';
66
import { DeviceAPIMessageSchema } from './protobufs/device-api_pb';
77
import { commonMessageHandler, handleConnect } from './common/handler';
8-
import { DeviceType, PrismaClient } from './generated/prisma';
8+
import { PrismaClient } from './generated/prisma/client';
99
import { redis } from './redis';
1010
import { lanternMessageHandler, lanternQueueHandler } from './lantern/handler';
1111
import { matrxMessageHandler, matrxQueueHandler } from './matrx/handler';
1212
import { getDefaultTypeSettings, getDeviceTypeFromCN } from './common/utils';
13+
import { PrismaPg } from '@prisma/adapter-pg';
1314

14-
const prisma = new PrismaClient();
15+
const adapter = new PrismaPg({
16+
connectionString: process.env.DATABASE_URL || 'postgresql://user:password@localhost:5432/mydb',
17+
})
18+
const prisma = new PrismaClient({
19+
adapter
20+
});
1521
const port = 9091;
1622

1723

src/lantern/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { WebSocketAdapter } from "../types";
22
import { KDGlobalMessageSchema, OKResponseSchema } from "../protobufs/kd_global_pb";
3-
import { PrismaClient } from "../generated/prisma";
3+
import { PrismaClient } from "../generated/prisma/client";
44
import { create, toBinary } from "@bufbuild/protobuf";
55
import { DeviceAPIMessageSchema } from "../protobufs/device-api_pb";
66
import { KDLanternMessage, KDLanternMessageSchema, SetColorSchema, TouchEvent } from "../protobufs/kd_lantern_pb";

src/matrx/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { WebSocketAdapter } from "../types";
2-
import { PrismaClient } from "../generated/prisma";
2+
import { PrismaClient } from "../generated/prisma/client";
33
import { create, toBinary } from "@bufbuild/protobuf";
44
import { DeviceAPIMessageSchema } from "../protobufs/device-api_pb";
55
import { RedisConnection } from "../redis";

0 commit comments

Comments
 (0)