Sprint 4-5: 员工自助+考勤+合规+AI+搜索

This commit is contained in:
selfrelease
2026-08-01 06:45:59 +08:00
parent 9946197d20
commit a88c96299c
16 changed files with 1919 additions and 35 deletions
+21
View File
@@ -105,6 +105,27 @@ router.post('/confirm', authMiddleware, async (req: AuthRequest, res: Response,
}
})
/** HR 批量确认考勤 */
router.post('/batch-confirm', authMiddleware, async (req: AuthRequest, res: Response, next: NextFunction) => {
try {
const schema = z.object({
month: z.string().regex(/^\d{4}-\d{2}$/),
ids: z.array(z.string()).optional(),
all: z.boolean().optional(),
})
const { month, ids, all } = schema.parse(req.body)
const where: any = { orgId: req.user!.orgId, month, status: 'PENDING' }
if (!all && ids?.length) {
where.id = { in: ids }
}
const result = await prisma.attendanceConfirmation.updateMany({
where,
data: { status: 'CONFIRMED', confirmedAt: new Date(), confirmedBy: req.user!.id },
})
res.json({ success: true, data: { count: result.count } })
} catch (err) { next(err) }
})
// ========== 班次管理 ==========
router.get('/shifts', authMiddleware, async (req: AuthRequest, res: Response, next: NextFunction) => {