import legacy frontend & fix dependency issues
This commit is contained in:
@@ -4,10 +4,10 @@ import { PrismaClient } from "../../generated/prisma/client.js";
|
||||
import { Injectable } from "../../infrastructure/di/injectable-decorator.js";
|
||||
|
||||
type ExtendedClient = ReturnType<typeof createExtendedClient>;
|
||||
type TransactionClient = Omit<
|
||||
ExtendedClient,
|
||||
"$connect" | "$disconnect" | "$on" | "$transaction" | "$extends"
|
||||
>;
|
||||
// type TransactionClient = Omit<
|
||||
// ExtendedClient,
|
||||
// "$connect" | "$disconnect" | "$on" | "$transaction" | "$extends"
|
||||
// >;
|
||||
|
||||
export type SafeClient = Omit<
|
||||
ExtendedClient,
|
||||
@@ -58,13 +58,8 @@ export class DatabaseService {
|
||||
command: (prisma: SafeClient) => Promise<T>,
|
||||
request: Request,
|
||||
): Promise<T> {
|
||||
const transaction = (request as any).transaction as SafeClient;
|
||||
const transaction =
|
||||
(request as any).transaction ?? (this.prismaClient as SafeClient);
|
||||
return await command(transaction);
|
||||
}
|
||||
|
||||
public async createTransaction(
|
||||
action: (prisma: TransactionClient) => Promise<void>,
|
||||
) {
|
||||
await this.prismaClient.$transaction(action);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ import kcClientConfig from "./nodejs-api.json" with { type: "json" };
|
||||
|
||||
import KeycloakAdminClient from "@keycloak/keycloak-admin-client";
|
||||
import type RoleRepresentation from "@keycloak/keycloak-admin-client/lib/defs/roleRepresentation.js";
|
||||
import { Claim } from "../../../models/claim.js";
|
||||
import { type User } from "../../../models/user.js";
|
||||
import { Claim } from "../../../dtos/claim.js";
|
||||
import { type User } from "../../../dtos/user.js";
|
||||
|
||||
@Injectable()
|
||||
export class KeycloakAdmin {
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
{
|
||||
"realm": "taekwondo",
|
||||
"auth-server-url": "https://localhost:8080",
|
||||
"ssl-required": "external",
|
||||
"resource": "nodejs-api",
|
||||
"credentials": {
|
||||
"secret": "devsecret"
|
||||
},
|
||||
"confidential-port": 0
|
||||
"realm": "taekwondo",
|
||||
"auth-server-url": "http://localhost:8080/",
|
||||
"ssl-required": "external",
|
||||
"resource": "angular-frontend",
|
||||
"public-client": true,
|
||||
"confidential-port": 0
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import express from "express";
|
||||
import { inject, Injectable } from "../infrastructure/di/index.js";
|
||||
import { ErrorStates } from "../infrastructure/errorStates.js";
|
||||
import {
|
||||
type Member,
|
||||
type MemberCreateArgs,
|
||||
mapDbMemberToMember,
|
||||
} from "../models/member.js";
|
||||
} from "../dtos/member.js";
|
||||
import { inject, Injectable } from "../infrastructure/di/index.js";
|
||||
import { ErrorStates } from "../infrastructure/errorStates.js";
|
||||
import { DatabaseService } from "./db/prisma.js";
|
||||
|
||||
@Injectable()
|
||||
@@ -43,6 +43,10 @@ export class MembersService {
|
||||
createArgs: MemberCreateArgs,
|
||||
request: express.Request,
|
||||
): Promise<Member> {
|
||||
const x: MemberCreateArgs = {
|
||||
...createArgs,
|
||||
geburtsdatum: createArgs.geburtsdatum ?? null,
|
||||
};
|
||||
const newMember = await this.database.doRequest(
|
||||
async prisma => await prisma.member.create({ data: createArgs }),
|
||||
request,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Claim } from "../dtos/claim.js";
|
||||
import { type User } from "../dtos/user.js";
|
||||
import { inject } from "../infrastructure/di/index.js";
|
||||
import { Claim } from "../models/claim.js";
|
||||
import { type User } from "../models/user.js";
|
||||
import { KeycloakAdmin } from "./keycloak/admin/index.js";
|
||||
|
||||
export class UserService {
|
||||
|
||||
Reference in New Issue
Block a user