Restructuring the folders #1

Merged
mifi merged 10 commits from develop into main 2023-05-24 15:16:42 +00:00
5 changed files with 25 additions and 25 deletions
Showing only changes of commit da3f895777 - Show all commits

View File

@@ -1,9 +1,9 @@
import { Payload } from '../../types/Payload';
import { ServiceError } from './ServiceError';
import { Payload } from "../../types/Payload";
import { ServiceError } from "./ServiceError";
export class ApiError extends ServiceError {
constructor(message: string, debug?: Payload) {
super(message, debug);
this.name = 'ApiError';
}
constructor(message: string, debug?: Payload) {
super(message, debug);
this.name = "ApiError";
}
}

View File

@@ -1,9 +1,9 @@
import { Payload } from '../../types/Payload';
import { ServiceError } from './ServiceError';
import { Payload } from "../../types/Payload";
import { ServiceError } from "./ServiceError";
export class DatabaseError extends ServiceError {
constructor(message: string, debug?: Payload) {
super(message, debug);
this.name = 'DatabaseError';
}
constructor(message: string, debug?: Payload) {
super(message, debug);
this.name = "DatabaseError";
}
}

View File

@@ -1,12 +1,12 @@
import { Payload } from '../../types/Payload';
import { Payload } from "../../types/Payload";
export class ServiceError extends Error {
public env = process.env;
public debug?: Payload;
public env = process.env;
public debug?: Payload;
constructor(message: string, debug?: Payload) {
super(message);
this.name = 'ServiceError';
this.debug = debug;
}
constructor(message: string, debug?: Payload) {
super(message);
this.name = "ServiceError";
this.debug = debug;
}
}

View File

@@ -1,7 +1,7 @@
import { Payload } from './Payload';
import { Payload } from "./Payload";
export interface ApiResponse<T = Payload> {
data?: T;
error?: Error | string | number;
success: boolean;
data?: T;
error?: Error | string | number;
success: boolean;
}

View File

@@ -3,5 +3,5 @@ type PayloadArray = (PayloadPrimitives | Payload)[];
type PayloadValid = PayloadPrimitives | PayloadArray | Payload;
export interface Payload<T = object> {
[key: string]: PayloadValid | T;
[key: string]: PayloadValid | T;
}