Platform Marketing Content: - Add PaginationParams, PaginationMeta, PaginatedResponse interfaces - Fix JwtAuthGuard import paths (common/guards instead of modules/auth) - Add missing fields to CRM interfaces (address, keywords, features, benefits) - Install @nestjs/throttler dependency ERP Suite - Construccion: - Create tsconfig.node.json for web frontend - Add vite-env.d.ts for Vite types - Fix implicit return errors in Express controllers - Prefix unused parameters with underscore ERP Suite - ERP Core: - Export PoolClient type from database config - Fix invoice type comparison (customer/supplier vs out_invoice) - Refactor base.service.ts query handling for proper type inference - Rename Role type to RoleType to avoid conflict with entity - Fix ProtectedRoute to use role?.name instead of roles array ERP Suite - POS Micro: - Add vite-env.d.ts for Vite types - Fix Sale property names (discountAmount, changeAmount) - Export TodaySummary interface from sales service All projects now pass npm install and npm run build successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
357 lines
7.1 KiB
TypeScript
357 lines
7.1 KiB
TypeScript
/**
|
|
* Universal Enums - Core Constants
|
|
*
|
|
* Enums compartidos entre todos los proyectos del workspace.
|
|
* Estos son los enums "universales" que aplican a múltiples proyectos.
|
|
* Los enums específicos de cada proyecto deben estar en su propio repositorio.
|
|
*
|
|
* @module @core/constants/enums
|
|
* @version 1.0.0
|
|
*/
|
|
|
|
// ============================================================================
|
|
// USER STATUS & ROLES (Universal)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* User status across all applications
|
|
*/
|
|
export enum UserStatus {
|
|
ACTIVE = 'active',
|
|
INACTIVE = 'inactive',
|
|
PENDING = 'pending',
|
|
SUSPENDED = 'suspended',
|
|
BANNED = 'banned',
|
|
DELETED = 'deleted',
|
|
}
|
|
|
|
/**
|
|
* Base user roles (can be extended per project)
|
|
*/
|
|
export enum BaseRole {
|
|
SUPER_ADMIN = 'super_admin',
|
|
ADMIN = 'admin',
|
|
USER = 'user',
|
|
GUEST = 'guest',
|
|
}
|
|
|
|
// ============================================================================
|
|
// AUTHENTICATION (Universal)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Authentication providers
|
|
*/
|
|
export enum AuthProvider {
|
|
LOCAL = 'local',
|
|
GOOGLE = 'google',
|
|
FACEBOOK = 'facebook',
|
|
APPLE = 'apple',
|
|
GITHUB = 'github',
|
|
MICROSOFT = 'microsoft',
|
|
}
|
|
|
|
/**
|
|
* Token types
|
|
*/
|
|
export enum TokenType {
|
|
ACCESS = 'access',
|
|
REFRESH = 'refresh',
|
|
RESET_PASSWORD = 'reset_password',
|
|
EMAIL_VERIFICATION = 'email_verification',
|
|
API_KEY = 'api_key',
|
|
}
|
|
|
|
/**
|
|
* Session status
|
|
*/
|
|
export enum SessionStatus {
|
|
ACTIVE = 'active',
|
|
EXPIRED = 'expired',
|
|
REVOKED = 'revoked',
|
|
}
|
|
|
|
// ============================================================================
|
|
// SUBSCRIPTION & BILLING (Universal)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Subscription tiers
|
|
*/
|
|
export enum SubscriptionTier {
|
|
FREE = 'free',
|
|
BASIC = 'basic',
|
|
PROFESSIONAL = 'professional',
|
|
ENTERPRISE = 'enterprise',
|
|
}
|
|
|
|
/**
|
|
* Subscription status
|
|
*/
|
|
export enum SubscriptionStatus {
|
|
ACTIVE = 'active',
|
|
INACTIVE = 'inactive',
|
|
CANCELLED = 'cancelled',
|
|
PAST_DUE = 'past_due',
|
|
TRIALING = 'trialing',
|
|
PAUSED = 'paused',
|
|
}
|
|
|
|
/**
|
|
* Payment status
|
|
*/
|
|
export enum PaymentStatus {
|
|
PENDING = 'pending',
|
|
PROCESSING = 'processing',
|
|
COMPLETED = 'completed',
|
|
FAILED = 'failed',
|
|
REFUNDED = 'refunded',
|
|
CANCELLED = 'cancelled',
|
|
}
|
|
|
|
/**
|
|
* Payment methods
|
|
*/
|
|
export enum PaymentMethod {
|
|
CREDIT_CARD = 'credit_card',
|
|
DEBIT_CARD = 'debit_card',
|
|
BANK_TRANSFER = 'bank_transfer',
|
|
PAYPAL = 'paypal',
|
|
STRIPE = 'stripe',
|
|
CASH = 'cash',
|
|
}
|
|
|
|
// ============================================================================
|
|
// NOTIFICATIONS (Universal)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Notification types
|
|
*/
|
|
export enum NotificationType {
|
|
INFO = 'info',
|
|
SUCCESS = 'success',
|
|
WARNING = 'warning',
|
|
ERROR = 'error',
|
|
ALERT = 'alert',
|
|
}
|
|
|
|
/**
|
|
* Notification channels
|
|
*/
|
|
export enum NotificationChannel {
|
|
EMAIL = 'email',
|
|
PUSH = 'push',
|
|
SMS = 'sms',
|
|
IN_APP = 'in_app',
|
|
WEBHOOK = 'webhook',
|
|
}
|
|
|
|
/**
|
|
* Notification priority
|
|
*/
|
|
export enum NotificationPriority {
|
|
LOW = 'low',
|
|
MEDIUM = 'medium',
|
|
HIGH = 'high',
|
|
CRITICAL = 'critical',
|
|
}
|
|
|
|
/**
|
|
* Notification status
|
|
*/
|
|
export enum NotificationStatus {
|
|
PENDING = 'pending',
|
|
SENT = 'sent',
|
|
DELIVERED = 'delivered',
|
|
READ = 'read',
|
|
FAILED = 'failed',
|
|
}
|
|
|
|
// ============================================================================
|
|
// CONTENT STATUS (Universal)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Content/Entity status
|
|
*/
|
|
export enum ContentStatus {
|
|
DRAFT = 'draft',
|
|
PENDING_REVIEW = 'pending_review',
|
|
PUBLISHED = 'published',
|
|
ARCHIVED = 'archived',
|
|
DELETED = 'deleted',
|
|
}
|
|
|
|
/**
|
|
* Media types
|
|
*/
|
|
export enum MediaType {
|
|
IMAGE = 'image',
|
|
VIDEO = 'video',
|
|
AUDIO = 'audio',
|
|
DOCUMENT = 'document',
|
|
PDF = 'pdf',
|
|
SPREADSHEET = 'spreadsheet',
|
|
}
|
|
|
|
/**
|
|
* File processing status
|
|
*/
|
|
export enum ProcessingStatus {
|
|
PENDING = 'pending',
|
|
PROCESSING = 'processing',
|
|
COMPLETED = 'completed',
|
|
FAILED = 'failed',
|
|
}
|
|
|
|
// ============================================================================
|
|
// AUDIT & LOGGING (Universal)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Audit action types
|
|
*/
|
|
export enum AuditAction {
|
|
CREATE = 'create',
|
|
READ = 'read',
|
|
UPDATE = 'update',
|
|
DELETE = 'delete',
|
|
LOGIN = 'login',
|
|
LOGOUT = 'logout',
|
|
EXPORT = 'export',
|
|
IMPORT = 'import',
|
|
}
|
|
|
|
/**
|
|
* Log levels
|
|
*/
|
|
export enum LogLevel {
|
|
DEBUG = 'debug',
|
|
INFO = 'info',
|
|
WARN = 'warn',
|
|
ERROR = 'error',
|
|
FATAL = 'fatal',
|
|
}
|
|
|
|
// ============================================================================
|
|
// UI/PREFERENCES (Universal)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Theme options
|
|
*/
|
|
export enum Theme {
|
|
LIGHT = 'light',
|
|
DARK = 'dark',
|
|
AUTO = 'auto',
|
|
}
|
|
|
|
/**
|
|
* Supported languages
|
|
*/
|
|
export enum Language {
|
|
ES = 'es',
|
|
EN = 'en',
|
|
FR = 'fr',
|
|
PT = 'pt',
|
|
}
|
|
|
|
/**
|
|
* Device types
|
|
*/
|
|
export enum DeviceType {
|
|
DESKTOP = 'desktop',
|
|
MOBILE = 'mobile',
|
|
TABLET = 'tablet',
|
|
UNKNOWN = 'unknown',
|
|
}
|
|
|
|
// ============================================================================
|
|
// TIME PERIODS (Universal)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Time periods for reports/aggregations
|
|
*/
|
|
export enum TimePeriod {
|
|
HOURLY = 'hourly',
|
|
DAILY = 'daily',
|
|
WEEKLY = 'weekly',
|
|
MONTHLY = 'monthly',
|
|
QUARTERLY = 'quarterly',
|
|
YEARLY = 'yearly',
|
|
}
|
|
|
|
/**
|
|
* Days of week
|
|
*/
|
|
export enum DayOfWeek {
|
|
MONDAY = 'monday',
|
|
TUESDAY = 'tuesday',
|
|
WEDNESDAY = 'wednesday',
|
|
THURSDAY = 'thursday',
|
|
FRIDAY = 'friday',
|
|
SATURDAY = 'saturday',
|
|
SUNDAY = 'sunday',
|
|
}
|
|
|
|
// ============================================================================
|
|
// SORT & FILTER (Universal)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Sort direction
|
|
*/
|
|
export enum SortDirection {
|
|
ASC = 'asc',
|
|
DESC = 'desc',
|
|
}
|
|
|
|
/**
|
|
* Comparison operators
|
|
*/
|
|
export enum ComparisonOperator {
|
|
EQUALS = 'eq',
|
|
NOT_EQUALS = 'ne',
|
|
GREATER_THAN = 'gt',
|
|
GREATER_THAN_OR_EQUALS = 'gte',
|
|
LESS_THAN = 'lt',
|
|
LESS_THAN_OR_EQUALS = 'lte',
|
|
CONTAINS = 'contains',
|
|
STARTS_WITH = 'starts_with',
|
|
ENDS_WITH = 'ends_with',
|
|
IN = 'in',
|
|
NOT_IN = 'not_in',
|
|
IS_NULL = 'is_null',
|
|
IS_NOT_NULL = 'is_not_null',
|
|
}
|
|
|
|
// ============================================================================
|
|
// HELPERS
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Check if value is valid enum value
|
|
*/
|
|
export const isValidEnumValue = <T extends object>(
|
|
enumObj: T,
|
|
value: unknown,
|
|
): boolean => {
|
|
return Object.values(enumObj).includes(value);
|
|
};
|
|
|
|
/**
|
|
* Get all values from enum
|
|
*/
|
|
export const getEnumValues = <T extends object>(enumObj: T): string[] => {
|
|
return Object.values(enumObj);
|
|
};
|
|
|
|
/**
|
|
* Get all keys from enum
|
|
*/
|
|
export const getEnumKeys = <T extends object>(enumObj: T): string[] => {
|
|
return Object.keys(enumObj).filter((key) => isNaN(Number(key)));
|
|
};
|