Skip to content

Commit

Permalink
Prettier fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chadmmills committed Nov 28, 2023
1 parent 5749850 commit 3d6a1e4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export function up(): string {
expires_at timestamp NOT NULL,
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE
);`
);`;
}

export function down(): string | void {
return 'DROP TABLE auth_sessions'
return "DROP TABLE auth_sessions";
}
11 changes: 7 additions & 4 deletions packages/api/routes/api/sessions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ export function post({ payload }: ApiHandlerArgs): ApiHandlerResponse {
// }

return new Response(JSON.stringify({}), {
headers: { "content-type": "application/json" },
status: 400,
})
headers: { "content-type": "application/json" },
status: 400,
});
}

const sessionPayloadSchema = z.object({
Expand All @@ -22,6 +22,9 @@ const sessionPayloadSchema = z.object({
});

// used to parse the body of a request
export const payloadParser = (raw: unknown, parser: typeof sessionPayloadSchema = sessionPayloadSchema) => {
export const payloadParser = (
raw: unknown,
parser: typeof sessionPayloadSchema = sessionPayloadSchema,
) => {
return parser.parse(raw);
};
5 changes: 3 additions & 2 deletions packages/api/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default {
fetch: middlewares(fetch, logRequest),
} satisfies Serve;


type MiddlewareFn = (req: Request, res: Response) => Promise<Response>;

function middlewares(...fns: MiddlewareFn[]) {
Expand All @@ -44,7 +43,9 @@ function middlewares(...fns: MiddlewareFn[]) {
}

function logRequest(req: Request, res: Response): Promise<Response> {
console.info(req.method + ": " + new URL(req.url).pathname + " " + res.status);
console.info(
req.method + ": " + new URL(req.url).pathname + " " + res.status,
);

return Promise.resolve(res);
}

0 comments on commit 3d6a1e4

Please sign in to comment.