From 01077dab22b5e82639bcd44df89e222ffee3f299 Mon Sep 17 00:00:00 2001 From: Stephan <57194608+stephan418@users.noreply.github.com> Date: Wed, 27 Apr 2022 08:24:34 +0200 Subject: [PATCH] Change name from oragnisation to organisation --- src/Controllers/common.ts | 8 ++++---- src/Controllers/group.controllers.ts | 14 +++++++------- src/Controllers/organisation.controller.ts | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Controllers/common.ts b/src/Controllers/common.ts index 1658ef5..a9a0caf 100644 --- a/src/Controllers/common.ts +++ b/src/Controllers/common.ts @@ -72,20 +72,20 @@ type Organisation = Partial; type Group = Partial; export async function handleCreateByName( - create: { type: "oragnisation"; data: Organisation }, + create: { type: "organisation"; data: Organisation }, link: { type: "event"; id: string }, req: Request, res: Response ): Promise; export async function handleCreateByName( create: { type: "group"; data: Group }, - link: { type: "oragnisation"; id: string }, + link: { type: "organisation"; id: string }, req: Request, res: Response ): Promise; export async function handleCreateByName( - create: { type: "oragnisation" | "group"; data: Organisation | Group }, - link: { type: "event" | "oragnisation"; id: string }, + create: { type: "organisation" | "group"; data: Organisation | Group }, + link: { type: "event" | "organisation"; id: string }, req: Request, res: Response ) { diff --git a/src/Controllers/group.controllers.ts b/src/Controllers/group.controllers.ts index 54ab975..10f42c7 100644 --- a/src/Controllers/group.controllers.ts +++ b/src/Controllers/group.controllers.ts @@ -7,12 +7,12 @@ import { generateError, genericError, handleCreateByName } from "./common"; const basicGroup = { pid: true, name: true, - oragnisation: { select: { pid: true, name: true } }, + organisation: { select: { pid: true, name: true } }, } as const; export const _getAllGroups = async (res: Response, organisationId: string | undefined) => { const groups = await prisma.group.findMany({ - where: { oragnisation: { pid: organisationId } }, + where: { organisation: { pid: organisationId } }, select: basicGroup, }); @@ -51,7 +51,7 @@ export const getGroup = async (req: Request, res: Response) const group: { pid: string; name: string; - oragnisation: { pid: string; name: string }; + organisation: { pid: string; name: string }; admins?: { pid: string; name: string }[]; participants?: { pid: string }[]; } | null = await prisma.group.findUnique({ @@ -60,7 +60,7 @@ export const getGroup = async (req: Request, res: Response) ? { pid: true, name: true, - oragnisation: { select: { pid: true, name: true } }, + organisation: { select: { pid: true, name: true } }, admins: { select: { pid: true, name: true } }, participants: { select: { pid: true } }, } @@ -77,8 +77,8 @@ export const getGroup = async (req: Request, res: Response) group: { ...group, organisation: { - ...group.oragnisation, - _links: [{ rel: "self", type: "GET", href: `/api/organisation/${group.oragnisation.pid}` }], + ...group.organisation, + _links: [{ rel: "self", type: "GET", href: `/api/organisation/${group.organisation.pid}` }], }, ...(req.auth?.isAuthenticated ? { @@ -109,7 +109,7 @@ export const getGroup = async (req: Request, res: Response) export const createGroup = async (req: Request<{ organisationPid: string }, {}, { name?: string }>, res: Response) => { return handleCreateByName( { type: "group", data: { name: req.body.name, level: 1 } }, - { type: "oragnisation", id: req.params.organisationPid }, + { type: "organisation", id: req.params.organisationPid }, req, res ); diff --git a/src/Controllers/organisation.controller.ts b/src/Controllers/organisation.controller.ts index 8a22d64..146594e 100644 --- a/src/Controllers/organisation.controller.ts +++ b/src/Controllers/organisation.controller.ts @@ -125,7 +125,7 @@ export const createOrganisation = async ( res: Response ) => { return handleCreateByName( - { type: "oragnisation", data: { name: req.body.name } }, + { type: "organisation", data: { name: req.body.name } }, { type: "event", id: req.params.eventPid }, req, res