From 7e1a63e048fc39bd3c35c9e8a596dc8daf7df25f Mon Sep 17 00:00:00 2001 From: KMKoushik Date: Thu, 5 Sep 2024 09:21:11 +1000 Subject: [PATCH] prettier --- .../public-api/api/contacts/delete-contact.ts | 72 +++++++-------- .../public-api/api/contacts/upsert-contact.ts | 88 +++++++++---------- 2 files changed, 80 insertions(+), 80 deletions(-) diff --git a/apps/web/src/server/public-api/api/contacts/delete-contact.ts b/apps/web/src/server/public-api/api/contacts/delete-contact.ts index 5a21e79..21b0117 100644 --- a/apps/web/src/server/public-api/api/contacts/delete-contact.ts +++ b/apps/web/src/server/public-api/api/contacts/delete-contact.ts @@ -5,49 +5,49 @@ import { deleteContact } from "~/server/service/contact-service"; import { getContactBook } from "../../api-utils"; const route = createRoute({ - method: "delete", - path: "/v1/contactBooks/{contactBookId}/contacts/{contactId}", - request: { - params: z.object({ - contactBookId: z.string().openapi({ - param: { - name: "contactBookId", - in: "path", - }, - example: "cuiwqdj74rygf74", - }), - contactId: z.string().openapi({ - param: { - name: "contactId", - in: "path", - }, - example: "cuiwqdj74rygf74", - }), - }), - }, - responses: { - 200: { - content: { - "application/json": { - schema: z.object({ success: z.boolean() }), - }, - }, - description: "Contact deleted successfully", + method: "delete", + path: "/v1/contactBooks/{contactBookId}/contacts/{contactId}", + request: { + params: z.object({ + contactBookId: z.string().openapi({ + param: { + name: "contactBookId", + in: "path", }, + example: "cuiwqdj74rygf74", + }), + contactId: z.string().openapi({ + param: { + name: "contactId", + in: "path", + }, + example: "cuiwqdj74rygf74", + }), + }), + }, + responses: { + 200: { + content: { + "application/json": { + schema: z.object({ success: z.boolean() }), + }, + }, + description: "Contact deleted successfully", }, + }, }); function deleteContactHandler(app: PublicAPIApp) { - app.openapi(route, async (c) => { - const team = await getTeamFromToken(c); + app.openapi(route, async (c) => { + const team = await getTeamFromToken(c); - await getContactBook(c, team.id); - const contactId = c.req.param("contactId"); + await getContactBook(c, team.id); + const contactId = c.req.param("contactId"); - await deleteContact(contactId); + await deleteContact(contactId); - return c.json({ success: true }); - }); + return c.json({ success: true }); + }); } -export default deleteContactHandler; \ No newline at end of file +export default deleteContactHandler; diff --git a/apps/web/src/server/public-api/api/contacts/upsert-contact.ts b/apps/web/src/server/public-api/api/contacts/upsert-contact.ts index 3d97f2b..eef2252 100644 --- a/apps/web/src/server/public-api/api/contacts/upsert-contact.ts +++ b/apps/web/src/server/public-api/api/contacts/upsert-contact.ts @@ -5,61 +5,61 @@ import { addOrUpdateContact } from "~/server/service/contact-service"; import { getContactBook } from "../../api-utils"; const route = createRoute({ - method: "put", - path: "/v1/contactBooks/{contactBookId}/contacts/{contactId}", - request: { - params: z.object({ - contactBookId: z - .string() - .min(3) - .openapi({ - param: { - name: "contactBookId", - in: "path", - }, - example: "cuiwqdj74rygf74", - }), + method: "put", + path: "/v1/contactBooks/{contactBookId}/contacts/{contactId}", + request: { + params: z.object({ + contactBookId: z + .string() + .min(3) + .openapi({ + param: { + name: "contactBookId", + in: "path", + }, + example: "cuiwqdj74rygf74", }), - body: { - required: true, - content: { - "application/json": { - schema: z.object({ - email: z.string(), - firstName: z.string().optional(), - lastName: z.string().optional(), - properties: z.record(z.string()).optional(), - subscribed: z.boolean().optional(), - }), - }, - }, + }), + body: { + required: true, + content: { + "application/json": { + schema: z.object({ + email: z.string(), + firstName: z.string().optional(), + lastName: z.string().optional(), + properties: z.record(z.string()).optional(), + subscribed: z.boolean().optional(), + }), }, + }, }, - responses: { - 200: { - content: { - "application/json": { - schema: z.object({ contactId: z.string() }), - }, - }, - description: "Contact upserted successfully", + }, + responses: { + 200: { + content: { + "application/json": { + schema: z.object({ contactId: z.string() }), }, + }, + description: "Contact upserted successfully", }, + }, }); function upsertContact(app: PublicAPIApp) { - app.openapi(route, async (c) => { - const team = await getTeamFromToken(c); + app.openapi(route, async (c) => { + const team = await getTeamFromToken(c); - const contactBook = await getContactBook(c, team.id); + const contactBook = await getContactBook(c, team.id); - const contact = await addOrUpdateContact( - contactBook.id, - c.req.valid("json") - ); + const contact = await addOrUpdateContact( + contactBook.id, + c.req.valid("json") + ); - return c.json({ contactId: contact.id }); - }); + return c.json({ contactId: contact.id }); + }); } export default upsertContact;