From d8b9bbc4527493f5fa2e8c9a88f62a30073330b4 Mon Sep 17 00:00:00 2001 From: zomars Date: Mon, 16 May 2022 15:06:29 -0600 Subject: [PATCH] Linting --- README.md | 30 ++++++++++++------------- package.json | 2 +- templates/README.md | 9 ++++---- templates/endpoints/[id]/delete.ts | 2 +- templates/endpoints/[id]/edit.ts | 2 +- templates/endpoints/[id]/index.ts | 2 +- templates/endpoints/get_all_and_post.ts | 8 +++---- templates/endpoints/post.ts | 2 +- types.d.ts | 1 - 9 files changed, 28 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index d210672e53..8c39f8457f 100644 --- a/README.md +++ b/README.md @@ -120,21 +120,21 @@ We aim to provide a fully tested API for our peace of mind, this is accomplished ## Endpoints matrix -| resource | get [id] | get all | create | edit | delete | -| ------------------------ | -------- | ------- | ------ | ---- | ------ | -| attendees | ✅ | ✅ | ✅ | ✅ | ✅ | -| availabilities | ✅ | ✅ | ✅ | ✅ | ✅ | -| booking-references | ✅ | ✅ | ✅ | ✅ | ✅ | -| event-references | ✅ | ✅ | ✅ | ✅ | ✅ | -| destination-calendars | ✅ | ✅ | ✅ | ✅ | ✅ | -| custom-inputs | ✅ | ✅ | ✅ | ✅ | ✅ | -| event-types | ✅ | ✅ | ✅ | ✅ | ✅ | -| memberships | ✅ | ✅ | ✅ | ✅ | ✅ | -| payments | ✅ | ✅ | ❌ | ❌ | ❌ | -| schedules | ✅ | ✅ | ✅ | ✅ | ✅ | -| selected-calendars | ✅ | ✅ | ✅ | ✅ | ✅ | -| teams | ✅ | ✅ | ✅ | ✅ | ✅ | -| users | ✅ | 👤[1] | ✅ | ✅ | ✅ | +| resource | get [id] | get all | create | edit | delete | +| --------------------- | -------- | ------- | ------ | ---- | ------ | +| attendees | ✅ | ✅ | ✅ | ✅ | ✅ | +| availabilities | ✅ | ✅ | ✅ | ✅ | ✅ | +| booking-references | ✅ | ✅ | ✅ | ✅ | ✅ | +| event-references | ✅ | ✅ | ✅ | ✅ | ✅ | +| destination-calendars | ✅ | ✅ | ✅ | ✅ | ✅ | +| custom-inputs | ✅ | ✅ | ✅ | ✅ | ✅ | +| event-types | ✅ | ✅ | ✅ | ✅ | ✅ | +| memberships | ✅ | ✅ | ✅ | ✅ | ✅ | +| payments | ✅ | ✅ | ❌ | ❌ | ❌ | +| schedules | ✅ | ✅ | ✅ | ✅ | ✅ | +| selected-calendars | ✅ | ✅ | ✅ | ✅ | ✅ | +| teams | ✅ | ✅ | ✅ | ✅ | ✅ | +| users | ✅ | 👤[1] | ✅ | ✅ | ✅ | ## Models from database that are not exposed diff --git a/package.json b/package.json index 14c34d18af..555cc3efaf 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "private": true, "scripts": { "dev": "next build && PORT=3002 next start", - "dev-real":"PORT=3002 next dev", + "dev-real": "PORT=3002 next dev", "start": "PORT=3002 next start", "build": "next build", "lint": "next lint", diff --git a/templates/README.md b/templates/README.md index 588797c42a..3a171b9318 100644 --- a/templates/README.md +++ b/templates/README.md @@ -11,10 +11,11 @@ Basically there's three places of the codebase you need to think about for each ## The example resource -model- and it's endpoints ### `pages/api/endpoint/` -| Method | route | action | -| ------ | ----- | ----- | -| GET | pages/api/endpoint/index.ts | Read All of your resource | -| POST |pages/api/endpoint/new.ts | Create new resource | + +| Method | route | action | +| ------ | --------------------------- | ------------------------- | +| GET | pages/api/endpoint/index.ts | Read All of your resource | +| POST | pages/api/endpoint/new.ts | Create new resource | ### `pages/api/endpoint/[id]/` diff --git a/templates/endpoints/[id]/delete.ts b/templates/endpoints/[id]/delete.ts index 79645cbdfd..39e026f418 100644 --- a/templates/endpoints/[id]/delete.ts +++ b/templates/endpoints/[id]/delete.ts @@ -32,7 +32,7 @@ import { * 401: * description: Authorization information is missing or invalid. */ -export async function deleteResource({query}: NextApiRequest, res: NextApiResponse) { +export async function deleteResource({ query }: NextApiRequest, res: NextApiResponse) { const safe = schemaQueryIdParseInt.safeParse(query); if (!safe.success) throw new Error("Invalid request query"); diff --git a/templates/endpoints/[id]/edit.ts b/templates/endpoints/[id]/edit.ts index 8346840ec3..cb4b1f05c5 100644 --- a/templates/endpoints/[id]/edit.ts +++ b/templates/endpoints/[id]/edit.ts @@ -33,7 +33,7 @@ import { * 401: * description: Authorization information is missing or invalid. */ -export async function editResource({query, body}: NextApiRequest, res: NextApiResponse) { +export async function editResource({ query, body }: NextApiRequest, res: NextApiResponse) { const safeQuery = schemaQueryIdParseInt.safeParse(query); const safeBody = schemaResourceBodyParams.safeParse(body); diff --git a/templates/endpoints/[id]/index.ts b/templates/endpoints/[id]/index.ts index 7933c5cab1..da3a2fd2dd 100644 --- a/templates/endpoints/[id]/index.ts +++ b/templates/endpoints/[id]/index.ts @@ -33,7 +33,7 @@ import { * 404: * description: Resource was not found */ -export async function resourceById({query}: NextApiRequest, res: NextApiResponse) { +export async function resourceById({ query }: NextApiRequest, res: NextApiResponse) { const safe = schemaQueryIdParseInt.safeParse(query); if (!safe.success) throw new Error("Invalid request query"); diff --git a/templates/endpoints/get_all_and_post.ts b/templates/endpoints/get_all_and_post.ts index e21dc8bb9d..ba35a7525b 100644 --- a/templates/endpoints/get_all_and_post.ts +++ b/templates/endpoints/get_all_and_post.ts @@ -7,12 +7,11 @@ import { PaymentResponse, PaymentsResponse } from "@lib/types"; import { schemaPaymentBodyParams, schemaPaymentPublic } from "@lib/validations/payment"; async function createOrlistAllPayments( - {method, body}: NextApiRequest, + { method, body }: NextApiRequest, res: NextApiResponse ) { if (method === "GET") { - -/** + /** * @swagger * /v1/payments: * get: @@ -38,8 +37,7 @@ async function createOrlistAllPayments( error, }); } else if (method === "POST") { - -/** + /** * @swagger * /v1/payments: * post: diff --git a/templates/endpoints/post.ts b/templates/endpoints/post.ts index 896c09e691..61cff72a15 100644 --- a/templates/endpoints/post.ts +++ b/templates/endpoints/post.ts @@ -29,7 +29,7 @@ import { schemaResourceBodyParams, schemaResourcePublic, withValidResource } fro * 401: * description: Authorization information is missing or invalid. */ -async function createResource({body}: NextApiRequest, res: NextApiResponse) { +async function createResource({ body }: NextApiRequest, res: NextApiResponse) { const safe = schemaResourceBodyParams.safeParse(body); if (!safe.success) throw new Error("Invalid request body"); diff --git a/types.d.ts b/types.d.ts index 2abf07e4c1..9a7af651d1 100644 --- a/types.d.ts +++ b/types.d.ts @@ -1,2 +1 @@ declare module "modify-response-middleware"; -