Configuración inicial del proyecto: estructura de directorios y dependencias mínimas instaladas

This commit is contained in:
manu
2025-12-05 09:36:39 -05:00
commit 002c79abcb
60 changed files with 11057 additions and 0 deletions

3
lib/appwrite/client.ts Normal file
View File

@@ -0,0 +1,3 @@
// Appwrite client setup
// This file will be implemented when Appwrite SDK is installed

7
lib/appwrite/config.ts Normal file
View File

@@ -0,0 +1,7 @@
// Appwrite configuration
export const appwriteConfig = {
endpoint: process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT || '',
projectId: process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID || '',
databaseId: process.env.NEXT_PUBLIC_APPWRITE_DATABASE_ID || '',
};

3
lib/appwrite/database.ts Normal file
View File

@@ -0,0 +1,3 @@
// Appwrite database setup
// This file will be implemented when Appwrite SDK is installed

18
lib/constants/appwrite.ts Normal file
View File

@@ -0,0 +1,18 @@
// Appwrite collection and database constants
export const APPWRITE_COLLECTIONS = {
USERS: 'users',
VEHICLES: 'vehicles',
RESERVATIONS: 'reservations',
TRANSACTIONS: 'transactions',
PAYMENT_METHODS: 'payment_methods',
REVIEWS: 'reviews',
CONVERSATIONS: 'conversations',
MESSAGES: 'messages',
NOTIFICATIONS: 'notifications',
} as const;
export const APPWRITE_STORAGE_BUCKETS = {
PROFILE_IMAGES: 'profile-images',
VEHICLE_IMAGES: 'vehicle-images',
} as const;

20
lib/constants/routes.ts Normal file
View File

@@ -0,0 +1,20 @@
// Application routes constants
export const ROUTES = {
HOME: '/',
LOGIN: '/login',
REGISTER: '/register',
SEARCH: '/search',
VEHICLES: {
BASE: '/vehicles',
DETAIL: (id: string) => `/vehicles/${id}`,
},
DASHBOARD: '/dashboard',
PROFILE: '/profile',
RESERVATIONS: '/reservations',
VEHICLES_MANAGE: {
BASE: '/dashboard/vehicles',
CREATE: '/dashboard/vehicles/create',
EDIT: (id: string) => `/dashboard/vehicles/${id}`,
},
} as const;

6
lib/utils.ts Normal file
View File

@@ -0,0 +1,6 @@
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}

View File

@@ -0,0 +1,86 @@
// Common validation schemas reusable across modules
import { z } from 'zod';
/**
* Email validation schema
*/
export const emailSchema = z.string().email('Email inválido');
/**
* Password validation schema
* - Minimum 8 characters
* - At least one uppercase letter
* - At least one lowercase letter
* - At least one number
*/
export const passwordSchema = z
.string()
.min(8, 'La contraseña debe tener al menos 8 caracteres')
.regex(/[A-Z]/, 'Debe contener al menos una mayúscula')
.regex(/[a-z]/, 'Debe contener al menos una minúscula')
.regex(/[0-9]/, 'Debe contener al menos un número');
/**
* Phone number validation schema
* Supports international format with optional +
*/
export const phoneSchema = z
.string()
.regex(/^\+?[1-9]\d{1,14}$/, 'Número de teléfono inválido')
.optional();
/**
* URL validation schema
*/
export const urlSchema = z.string().url('URL inválida');
/**
* Date validation schema with coercion
*/
export const dateSchema = z.coerce.date();
/**
* Date range validation schema
* Ensures end date is after start date
*/
export const dateRangeSchema = z
.object({
start: z.coerce.date(),
end: z.coerce.date(),
})
.refine((data) => data.end > data.start, {
message: 'La fecha de fin debe ser posterior a la fecha de inicio',
path: ['end'],
});
/**
* Positive number schema
*/
export const positiveNumberSchema = z.number().positive('El valor debe ser mayor a 0');
/**
* Non-empty string schema
*/
export const nonEmptyStringSchema = z.string().min(1, 'Este campo es requerido');
/**
* Image file validation schema
* - Max size: 5MB
* - Allowed types: JPEG, PNG, WebP
*/
export const imageFileSchema = z
.instanceof(File)
.refine((file) => file.size <= 5 * 1024 * 1024, 'El archivo debe ser menor a 5MB')
.refine(
(file) => ['image/jpeg', 'image/png', 'image/webp'].includes(file.type),
'Solo se permiten imágenes JPEG, PNG o WebP'
);
/**
* Multiple image files schema
*/
export const imageFilesSchema = z
.array(imageFileSchema)
.min(1, 'Al menos una imagen es requerida')
.max(10, 'Máximo 10 imágenes');

3
lib/validations/index.ts Normal file
View File

@@ -0,0 +1,3 @@
// Barrel exports for common validation schemas
export * from './common.schemas';