refactor(shared): centralize configuration and types
Migrate configuration validation and core moderation types from individual services to the `@bete/shared` package to ensure consistency across the monorepo. - Move `AppConfig` and moderation-related interfaces to `packages/shared`. - Replace service-specific Zod schemas with the centralized shared configuration. - Refactor `services/backend` and `services/discord-gateway` to consume shared config and types. - Remove redundant type definitions and local configuration logic in services. - Update `packages/shared` exports to include new `config` and `moderation-types` modules. - Clean up unused files and deprecated utility functions in `packages/shared`.
This commit is contained in:
@@ -33,30 +33,6 @@ export class UnauthorizedError extends AppError {
|
||||
}
|
||||
}
|
||||
|
||||
export class ForbiddenError extends AppError {
|
||||
constructor(message = "Forbidden") {
|
||||
super(message, "FORBIDDEN", 403);
|
||||
this.name = "ForbiddenError";
|
||||
}
|
||||
}
|
||||
|
||||
export class ConflictError extends AppError {
|
||||
constructor(message: string) {
|
||||
super(message, "CONFLICT", 409);
|
||||
this.name = "ConflictError";
|
||||
}
|
||||
}
|
||||
|
||||
export class InternalServerError extends AppError {
|
||||
constructor(
|
||||
message = "Internal server error",
|
||||
details?: Record<string, unknown>,
|
||||
) {
|
||||
super(message, "INTERNAL_SERVER_ERROR", 500, details);
|
||||
this.name = "InternalServerError";
|
||||
}
|
||||
}
|
||||
|
||||
export class DatabaseError extends AppError {
|
||||
constructor(message: string, details?: Record<string, unknown>) {
|
||||
super(message, "DATABASE_ERROR", 500, details);
|
||||
@@ -70,17 +46,3 @@ export class ConfigError extends AppError {
|
||||
this.name = "ConfigError";
|
||||
}
|
||||
}
|
||||
|
||||
export class DiscordError extends AppError {
|
||||
constructor(message: string, details?: Record<string, unknown>) {
|
||||
super(message, "DISCORD_ERROR", 500, details);
|
||||
this.name = "DiscordError";
|
||||
}
|
||||
}
|
||||
|
||||
export class TimeoutError extends AppError {
|
||||
constructor(operation: string) {
|
||||
super(`${operation} timed out`, "TIMEOUT", 504);
|
||||
this.name = "TimeoutError";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user