Skip to content

Commit

Permalink
added discit-types dev dep
Browse files Browse the repository at this point in the history
  • Loading branch information
cdleveille committed Jun 8, 2024
1 parent f4a125d commit 47e84e8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 28 deletions.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"devDependencies": {
"@types/uuid": "^9.0.8",
"bun-types": "latest",
"discit-types": "^1.0.0",
"eslint": "^9.4.0",
"prettier": "^3.3.1",
"typescript": "^5.4.5",
Expand Down
3 changes: 2 additions & 1 deletion src/middleware/errorHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Elysia } from "elysia";

import { Config } from "@helpers";
import { log } from "@services";
import { ApiError } from "@types";

export const useErrorHandler = (app: Elysia) => {
app.onError(({ error, request, path }) => {
Expand All @@ -10,6 +11,6 @@ export const useErrorHandler = (app: Elysia) => {
status?: number;
};
!Config.IS_PROD && log.error(`${new Date().toISOString()} ${request.method} ${path} ${status} ${message}`);
return { error: message };
return { error: message } satisfies ApiError;
});
};
33 changes: 6 additions & 27 deletions src/types/abstract.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import type * as shared from "discit-types";

export type IDisc = shared.Disc;
export type IBag = shared.Bag;
export type ApiError = shared.ApiError;

export interface IConfig {
IS_PROD: boolean;
PORT: number;
Expand All @@ -10,33 +16,6 @@ export interface IBase {
updated_at: Date;
}

export interface IDisc {
id: string;
name: string;
brand: string;
category: string;
speed: string;
glide: string;
turn: string;
fade: string;
stability: string;
link: string;
pic: string;
name_slug: string;
brand_slug: string;
category_slug: string;
stability_slug: string;
color: string;
background_color: string;
}

export interface IBag {
id: string;
name: string;
user_id: string;
discs: string[];
}

export type Projection = Record<string, 0 | 1>;

export type DiscFilterRegex = { $regex: string; $options: string };
Expand Down

0 comments on commit 47e84e8

Please sign in to comment.