Skip to content

Commit df8485b

Browse files
authored
Merge pull request #680 from j5ik2o/fix/build-errors-2025-02-13
fix: build errors
2 parents ba1320c + fd7ec5c commit df8485b

7 files changed

Lines changed: 51 additions & 30 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
branches: [ "main" ]
77
jobs:
88
lint:
9-
runs-on: ubuntu-latest
9+
runs-on: ubuntu-24.04
1010
name: "Run lint"
1111
steps:
1212
- uses: actions/checkout@v4
@@ -23,7 +23,7 @@ jobs:
2323
pnpm prisma:generate
2424
pnpm run lint
2525
test:
26-
runs-on: ubuntu-latest
26+
runs-on: ubuntu-24.04
2727
needs: lint
2828
env:
2929
TEST_TIME_FACTOR: 10.0
@@ -46,7 +46,7 @@ jobs:
4646
pnpm prisma:generate
4747
pnpm run test
4848
e2e:
49-
runs-on: ubuntu-latest
49+
runs-on: ubuntu-24.04
5050
needs: test
5151
env:
5252
TEST_TIME_FACTOR: 10.0

.github/workflows/openai-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ concurrency:
1515
cancel-in-progress: ${{ github.event_name != 'pull_request_review_comment' }}
1616
jobs:
1717
review:
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-24.04
1919
timeout-minutes: 15
2020
if: "!contains(github.event.pull_request.labels.*.name, 'renovate')"
2121
steps:

Dockerfile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
FROM node:20-alpine AS base
22

3+
RUN apk add --no-cache libc6-compat openssl3
4+
5+
RUN corepack disable
6+
RUN rm -f /usr/local/bin/pnpm /usr/local/bin/yarn /usr/local/bin/pnpm.js /usr/local/bin/yarn.js
7+
RUN npm install -g --force pnpm@8
8+
RUN which pnpm && pnpm --version
9+
310
FROM base AS builder
411

512
ENV PNPM_HOME="/pnpm"
613
ENV PATH="$PNPM_HOME:$PATH"
7-
RUN corepack enable
814

915
RUN apk add --no-cache libc6-compat
1016
WORKDIR /app
1117

1218
COPY . /app
1319

14-
RUN pnpm install -g turbo && pnpm install && pnpm prisma:generate && pnpm build
20+
RUN pnpm install -g turbo
21+
RUN pnpm install
22+
RUN pnpm prisma:generate
23+
RUN pnpm build
1524

1625
FROM base AS runner
1726
WORKDIR /app/packages/bootstrap

packages/bootstrap/src/local-rmu-main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import type {
1515
} from "aws-lambda";
1616
import { GroupChatDao, ReadModelUpdater } from "cqrs-es-example-js-rmu";
1717
import { logger } from "./index";
18+
import type { PrismaQueryEvent } from "./types";
1819

1920
async function localRmuMain() {
2021
logger.info("Starting local read model updater");
@@ -92,7 +93,7 @@ async function localRmuMain() {
9293
},
9394
log: [{ level: "query", emit: "event" }],
9495
});
95-
prisma.$on("query", async (e) => {
96+
prisma.$on("query", async (e: PrismaQueryEvent) => {
9697
logger.info(`Query: ${e.query}`);
9798
logger.info(`Params: ${e.params}`);
9899
logger.info(`Duration: ${e.duration}ms`);

packages/bootstrap/src/read-api-main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { PrismaClient } from "@prisma/client";
44
import { createQuerySchema } from "cqrs-es-example-js-query-interface-adaptor";
55
import type { QueryContext } from "cqrs-es-example-js-query-interface-adaptor";
66
import { logger } from "./index";
7+
import type { PrismaQueryEvent } from "./types";
78

89
interface MyContext {
910
prisma: PrismaClient;
@@ -34,7 +35,7 @@ async function readApiMain() {
3435
},
3536
log: [{ level: "query", emit: "event" }],
3637
});
37-
prisma.$on("query", async (e) => {
38+
prisma.$on("query", async (e: PrismaQueryEvent) => {
3839
logger.info(`Query: ${e.query}`);
3940
logger.info(`Params: ${e.params}`);
4041
logger.info(`Duration: ${e.duration}ms`);

packages/bootstrap/src/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export type PrismaQueryEvent = {
2+
timestamp: Date;
3+
query: string;
4+
params: string;
5+
duration: number;
6+
target?: string;
7+
};

packages/rmu/src/group-chat-dao.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { PrismaClient } from "@prisma/client";
2+
import type { Prisma } from "@prisma/client";
23
import {
34
type GroupChatId,
45
type GroupChatName,
@@ -18,28 +19,30 @@ class GroupChatDao {
1819
administratorId: UserAccountId,
1920
createdAt: Date,
2021
) {
21-
return await this.prismaClient.$transaction(async (_prismaClient) => {
22-
await _prismaClient.groupChats.create({
23-
data: {
24-
id: aggregateId.asString(),
25-
disabled: false,
26-
name: name.asString(),
27-
ownerId: administratorId.asString(),
28-
createdAt: createdAt,
29-
updatedAt: createdAt,
30-
},
31-
});
32-
await _prismaClient.members.create({
33-
data: {
34-
id: MemberId.generate().asString(),
35-
groupChatId: aggregateId.asString(),
36-
userAccountId: administratorId.asString(),
37-
role: "administrator",
38-
createdAt: createdAt,
39-
updatedAt: createdAt,
40-
},
41-
});
42-
});
22+
return await this.prismaClient.$transaction(
23+
async (_prismaClient: Prisma.TransactionClient) => {
24+
await _prismaClient.groupChats.create({
25+
data: {
26+
id: aggregateId.asString(),
27+
disabled: false,
28+
name: name.asString(),
29+
ownerId: administratorId.asString(),
30+
createdAt: createdAt,
31+
updatedAt: createdAt,
32+
},
33+
});
34+
await _prismaClient.members.create({
35+
data: {
36+
id: MemberId.generate().asString(),
37+
groupChatId: aggregateId.asString(),
38+
userAccountId: administratorId.asString(),
39+
role: "administrator",
40+
createdAt: createdAt,
41+
updatedAt: createdAt,
42+
},
43+
});
44+
},
45+
);
4346
}
4447

4548
async deleteGroupChat(aggregateId: GroupChatId, createdAt: Date) {

0 commit comments

Comments
 (0)