refractoring & add timesheet service
This commit is contained in:
@@ -5,7 +5,6 @@ import { validateBody } from '../middlewares/security/validateInput.js';
|
||||
import {
|
||||
loginSchema,
|
||||
setPasswordSchema,
|
||||
linkEmailSchema,
|
||||
} from '../validators/auth.validators.js';
|
||||
import {
|
||||
loginRateLimiter,
|
||||
@@ -39,25 +38,10 @@ router.post(
|
||||
authController.setPassword
|
||||
);
|
||||
|
||||
// KROK 3: Link email
|
||||
router.post(
|
||||
'/link-email',
|
||||
authenticate,
|
||||
sensitiveOperationLimiter,
|
||||
validateBody(linkEmailSchema),
|
||||
authController.linkEmail
|
||||
);
|
||||
|
||||
// KROK 3 (alternatíva): Skip email
|
||||
router.post('/skip-email', authenticate, authController.skipEmail);
|
||||
|
||||
// Logout
|
||||
router.post('/logout', authenticate, authController.logout);
|
||||
|
||||
// Get current session
|
||||
router.get('/session', authenticate, authController.getSession);
|
||||
|
||||
// Get current user profile
|
||||
router.get('/me', authenticate, authController.getMe);
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -24,13 +24,6 @@ router.get(
|
||||
companyController.getCompanyById
|
||||
);
|
||||
|
||||
// Get company with relations (projects, todos, notes)
|
||||
router.get(
|
||||
'/:companyId/details',
|
||||
validateParams(z.object({ companyId: z.string().uuid() })),
|
||||
companyController.getCompanyWithRelations
|
||||
);
|
||||
|
||||
// Create new company
|
||||
router.post(
|
||||
'/',
|
||||
|
||||
@@ -53,38 +53,4 @@ router.delete(
|
||||
contactController.removeContact
|
||||
);
|
||||
|
||||
// Link company to contact
|
||||
router.post(
|
||||
'/:contactId/link-company',
|
||||
validateParams(z.object({ contactId: z.string().uuid() })),
|
||||
validateBody(z.object({ companyId: z.string().uuid() })),
|
||||
contactController.linkCompanyToContact
|
||||
);
|
||||
|
||||
// Unlink company from contact
|
||||
router.post(
|
||||
'/:contactId/unlink-company',
|
||||
validateParams(z.object({ contactId: z.string().uuid() })),
|
||||
contactController.unlinkCompanyFromContact
|
||||
);
|
||||
|
||||
// Create company from contact
|
||||
router.post(
|
||||
'/:contactId/create-company',
|
||||
validateParams(z.object({ contactId: z.string().uuid() })),
|
||||
validateBody(
|
||||
z.object({
|
||||
name: z.string().optional(),
|
||||
email: z.string().email().optional(),
|
||||
phone: z.string().optional(),
|
||||
address: z.string().optional(),
|
||||
city: z.string().optional(),
|
||||
country: z.string().optional(),
|
||||
website: z.string().url().optional(),
|
||||
description: z.string().optional(),
|
||||
})
|
||||
),
|
||||
contactController.createCompanyFromContact
|
||||
);
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -42,13 +42,6 @@ router.post(
|
||||
crmEmailController.markThreadRead
|
||||
);
|
||||
|
||||
// Get emails for a specific contact
|
||||
router.get(
|
||||
'/contact/:contactId',
|
||||
validateParams(z.object({ contactId: z.string().uuid() })),
|
||||
crmEmailController.getContactEmails
|
||||
);
|
||||
|
||||
// Mark all emails from contact as read
|
||||
router.post(
|
||||
'/contact/:contactId/read',
|
||||
@@ -56,14 +49,6 @@ router.post(
|
||||
crmEmailController.markContactEmailsRead
|
||||
);
|
||||
|
||||
// Mark email as read/unread
|
||||
router.patch(
|
||||
'/:jmapId/read',
|
||||
validateParams(z.object({ jmapId: z.string() })),
|
||||
validateBody(z.object({ isRead: z.boolean() })),
|
||||
crmEmailController.markAsRead
|
||||
);
|
||||
|
||||
// Send email reply
|
||||
router.post(
|
||||
'/reply',
|
||||
|
||||
@@ -21,13 +21,6 @@ router.use(authenticate);
|
||||
// Get all email accounts for logged-in user
|
||||
router.get('/', emailAccountController.getEmailAccounts);
|
||||
|
||||
// Get specific email account
|
||||
router.get(
|
||||
'/:id',
|
||||
validateParams(z.object({ id: z.string().uuid() })),
|
||||
emailAccountController.getEmailAccount
|
||||
);
|
||||
|
||||
// Create new email account
|
||||
router.post(
|
||||
'/',
|
||||
@@ -36,23 +29,6 @@ router.post(
|
||||
emailAccountController.createEmailAccount
|
||||
);
|
||||
|
||||
// Update email account password
|
||||
router.patch(
|
||||
'/:id/password',
|
||||
validateParams(z.object({ id: z.string().uuid() })),
|
||||
validateBody(z.object({ emailPassword: z.string().min(1) })),
|
||||
sensitiveOperationLimiter,
|
||||
emailAccountController.updateEmailAccountPassword
|
||||
);
|
||||
|
||||
// Toggle email account status
|
||||
router.patch(
|
||||
'/:id/status',
|
||||
validateParams(z.object({ id: z.string().uuid() })),
|
||||
validateBody(z.object({ isActive: z.boolean() })),
|
||||
emailAccountController.toggleEmailAccountStatus
|
||||
);
|
||||
|
||||
// Set email account as primary
|
||||
router.post(
|
||||
'/:id/set-primary',
|
||||
|
||||
@@ -24,13 +24,6 @@ router.get(
|
||||
projectController.getProjectById
|
||||
);
|
||||
|
||||
// Get project with relations (company, todos, notes, timesheets)
|
||||
router.get(
|
||||
'/:projectId/details',
|
||||
validateParams(z.object({ projectId: z.string().uuid() })),
|
||||
projectController.getProjectWithRelations
|
||||
);
|
||||
|
||||
// Create new project
|
||||
router.post(
|
||||
'/',
|
||||
|
||||
@@ -49,6 +49,7 @@ router.post(
|
||||
validateBody(z.object({
|
||||
year: z.string().regex(/^\d{4}$/, 'Rok musí byť 4-miestne číslo'),
|
||||
month: z.string().regex(/^([1-9]|1[0-2])$/, 'Mesiac musí byť číslo od 1 do 12'),
|
||||
userId: z.string().uuid().optional(), // Optional: admin can upload for other users
|
||||
})),
|
||||
timesheetController.uploadTimesheet
|
||||
);
|
||||
|
||||
@@ -17,9 +17,6 @@ router.use(authenticate);
|
||||
// Get all todos
|
||||
router.get('/', todoController.getAllTodos);
|
||||
|
||||
// Get my todos (assigned to current user)
|
||||
router.get('/my', todoController.getMyTodos);
|
||||
|
||||
// Get todo by ID
|
||||
router.get(
|
||||
'/:todoId',
|
||||
@@ -27,13 +24,6 @@ router.get(
|
||||
todoController.getTodoById
|
||||
);
|
||||
|
||||
// Get todo with relations (project, company, assigned user, notes)
|
||||
router.get(
|
||||
'/:todoId/details',
|
||||
validateParams(z.object({ todoId: z.string().uuid() })),
|
||||
todoController.getTodoWithRelations
|
||||
);
|
||||
|
||||
// Create new todo
|
||||
router.post(
|
||||
'/',
|
||||
|
||||
Reference in New Issue
Block a user