Skip to content

Commit

Permalink
build: updated supertokens to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
cerinoligutom committed Jun 2, 2024
1 parent 9b2c129 commit 494856a
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 31 deletions.
1 change: 1 addition & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WORKDIR /usr/src/app

RUN npm install -g pnpm

COPY .husky/install.mjs .husky/install.mjs
COPY package.json ./
COPY pnpm-lock.yaml ./
COPY patches ./patches
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
REDIS_CONNECTION_URL: redis://redis

db:
image: postgres:15-alpine
image: postgres:16-alpine
user: root
restart: always
ports:
Expand All @@ -36,7 +36,7 @@ services:

# https://www.pgadmin.org/docs/pgadmin4/6.5/container_deployment.html
pgadmin:
image: dpage/pgadmin4:7.4
image: dpage/pgadmin4:latest
user: root
restart: always
ports:
Expand Down Expand Up @@ -66,7 +66,7 @@ services:
- REDIS_HOSTS=local:redis:6379

supertokens:
image: supertokens/supertokens-postgresql:6.0
image: supertokens/supertokens-postgresql:9.0
user: root
restart: always
environment:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"ioredis": "5.4.1",
"kysely": "0.27.3",
"pg": "8.11.5",
"supertokens-node": "15.0.2",
"supertokens-node": "18.0.0",
"tsconfig-paths": "4.2.0",
"uuid": "9.0.1",
"ws": "8.17.0",
Expand Down
62 changes: 39 additions & 23 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/db/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { ColumnType } from 'kysely';
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U>
? ColumnType<S, I | undefined, U>
: ColumnType<T, T | undefined, T>;
export type Generated<T> =
T extends ColumnType<infer S, infer I, infer U> ? ColumnType<S, I | undefined, U> : ColumnType<T, T | undefined, T>;
export type Timestamp = ColumnType<Date, Date | string, Date | string>;

export type SystemRole = {
Expand Down
3 changes: 2 additions & 1 deletion src/modules/auth/use-cases/login.use-case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { UserSchema } from '@/db/schema/index.js';
import { db } from '@/db/index.js';
import { Selectable } from 'kysely';
import { User } from '@/db/types.js';
import supertokens from 'supertokens-node';

const dtoSchema = z.object({
email: UserSchema.shape.email,
Expand Down Expand Up @@ -34,7 +35,7 @@ export async function loginUseCase(dto: LoginDTO, ctx: IContext): Promise<LoginU
// IMPORTANT:
// If you need to store session data, read more from the link below:
// https://supertokens.io/docs/session/common-customizations/sessions/new-session#storing-session-information
await Session.createNewSession(ctx.req, ctx.res, 'public', user.id);
await Session.createNewSession(ctx.req, ctx.res, 'public', supertokens.convertToRecipeUserId(user.id));

// When making graphql subscription requests, make sure to pass the sessionHandle in the `connectionParams` of the subscription client.
// https://github.com/apollographql/subscriptions-transport-ws#constructorurl-options-websocketimpl
Expand Down

0 comments on commit 494856a

Please sign in to comment.