Sprint 4-5: 员工自助+考勤+合规+AI+搜索
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user