Linting
parent
8f05c3e991
commit
d8b9bbc452
30
README.md
30
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
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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]/`
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import {
|
|||
* 401:
|
||||
* description: Authorization information is missing or invalid.
|
||||
*/
|
||||
export async function deleteResource({query}: NextApiRequest, res: NextApiResponse<BaseResponse>) {
|
||||
export async function deleteResource({ query }: NextApiRequest, res: NextApiResponse<BaseResponse>) {
|
||||
const safe = schemaQueryIdParseInt.safeParse(query);
|
||||
if (!safe.success) throw new Error("Invalid request query");
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import {
|
|||
* 401:
|
||||
* description: Authorization information is missing or invalid.
|
||||
*/
|
||||
export async function editResource({query, body}: NextApiRequest, res: NextApiResponse<ResourceResponse>) {
|
||||
export async function editResource({ query, body }: NextApiRequest, res: NextApiResponse<ResourceResponse>) {
|
||||
const safeQuery = schemaQueryIdParseInt.safeParse(query);
|
||||
const safeBody = schemaResourceBodyParams.safeParse(body);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import {
|
|||
* 404:
|
||||
* description: Resource was not found
|
||||
*/
|
||||
export async function resourceById({query}: NextApiRequest, res: NextApiResponse<ResourceResponse>) {
|
||||
export async function resourceById({ query }: NextApiRequest, res: NextApiResponse<ResourceResponse>) {
|
||||
const safe = schemaQueryIdParseInt.safeParse(query);
|
||||
if (!safe.success) throw new Error("Invalid request query");
|
||||
|
||||
|
|
|
@ -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<PaymentsResponse | PaymentResponse>
|
||||
) {
|
||||
if (method === "GET") {
|
||||
|
||||
/**
|
||||
/**
|
||||
* @swagger
|
||||
* /v1/payments:
|
||||
* get:
|
||||
|
@ -38,8 +37,7 @@ async function createOrlistAllPayments(
|
|||
error,
|
||||
});
|
||||
} else if (method === "POST") {
|
||||
|
||||
/**
|
||||
/**
|
||||
* @swagger
|
||||
* /v1/payments:
|
||||
* post:
|
||||
|
|
|
@ -29,7 +29,7 @@ import { schemaResourceBodyParams, schemaResourcePublic, withValidResource } fro
|
|||
* 401:
|
||||
* description: Authorization information is missing or invalid.
|
||||
*/
|
||||
async function createResource({body}: NextApiRequest, res: NextApiResponse<ResourceResponse>) {
|
||||
async function createResource({ body }: NextApiRequest, res: NextApiResponse<ResourceResponse>) {
|
||||
const safe = schemaResourceBodyParams.safeParse(body);
|
||||
if (!safe.success) throw new Error("Invalid request body");
|
||||
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
declare module "modify-response-middleware";
|
||||
|
||||
|
|
Loading…
Reference in New Issue