daisy-client / src /utils /constants.ts
Jessedbrown's picture
feat/init-daisy-client
6d643ca
Raw History Blame Contribute Delete
1.69 kB
// HTTP Status Codes
export const HTTP_STATUS = {
OK: 200,
CREATED: 201,
NO_CONTENT: 204,
BAD_REQUEST: 400,
UNAUTHORIZED: 401,
FORBIDDEN: 403,
NOT_FOUND: 404,
CONFLICT: 409,
UNPROCESSABLE_ENTITY: 422,
RATE_LIMITED: 429,
INTERNAL_SERVER_ERROR: 500,
BAD_GATEWAY: 502,
SERVICE_UNAVAILABLE: 503,
} as const;
// Error Codes
export const ERROR_CODES = {
NETWORK_ERROR: 'NETWORK_ERROR',
VALIDATION_ERROR: 'VALIDATION_ERROR',
UNAUTHORIZED: 'UNAUTHORIZED',
FORBIDDEN: 'FORBIDDEN',
NOT_FOUND: 'NOT_FOUND',
RATE_LIMIT: 'RATE_LIMIT',
API_ERROR: 'API_ERROR',
UNKNOWN_ERROR: 'UNKNOWN_ERROR',
} as const;
// Local Storage Keys
export const STORAGE_KEYS = {
AUTH_TOKEN: 'auth_token',
USER_PREFERENCES: 'user_preferences',
THEME: 'theme',
} as const;
// Query Key Prefixes
export const QUERY_KEYS = {
CLOSET: 'closet',
PRODUCTS: 'products',
SCRAPE: 'scrape',
} as const;
// Default Values
export const DEFAULTS = {
PAGE_SIZE: 20,
SEARCH_DEBOUNCE: 300,
TOAST_DURATION: 4000,
} as const;
// File Upload Constraints
export const FILE_CONSTRAINTS = {
MAX_FILES: 1,
ACCEPTED_FORMATS: ['image/jpeg', 'image/png', 'image/webp', 'image/heic'],
MAX_SIZE_MB: 25,
} as const;
// Validation Limits
export const VALIDATION_LIMITS = {
NAME_MAX_LENGTH: 100,
BRAND_MAX_LENGTH: 50,
SEARCH_QUERY_MAX_LENGTH: 200,
MAX_PAGINATION_LIMIT: 100,
} as const;
export type HttpStatus = (typeof HTTP_STATUS)[keyof typeof HTTP_STATUS];
export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
export type StorageKey = (typeof STORAGE_KEYS)[keyof typeof STORAGE_KEYS];
export type QueryKey = (typeof QUERY_KEYS)[keyof typeof QUERY_KEYS];