feat: debounce search, tambah filter source & date range di bug-reports, hapus seafile.ts
- Debounce search input (400ms, min 3 karakter) sesuai konvensi - Tambah filter source (QC/SYSTEM/USER) dan date range di bug-reports - Backend /api/bugs support query param source, dateFrom, dateTo - Update API_URLS.getBugs dengan param baru - Hapus seafile.ts (dead code, tidak digunakan)
This commit is contained in:
20
src/app.ts
20
src/app.ts
@@ -805,6 +805,9 @@ export function createApp() {
|
||||
const search = query.search || ''
|
||||
const app = query.app as any
|
||||
const status = query.status as any
|
||||
const source = query.source as any
|
||||
const dateFrom = query.dateFrom
|
||||
const dateTo = query.dateTo
|
||||
|
||||
const where: any = {}
|
||||
if (search) {
|
||||
@@ -821,6 +824,18 @@ export function createApp() {
|
||||
if (status && status !== 'all') {
|
||||
where.status = status
|
||||
}
|
||||
if (source && source !== 'all') {
|
||||
where.source = source
|
||||
}
|
||||
if (dateFrom || dateTo) {
|
||||
where.createdAt = {}
|
||||
if (dateFrom) where.createdAt.gte = new Date(dateFrom)
|
||||
if (dateTo) {
|
||||
const end = new Date(dateTo)
|
||||
end.setHours(23, 59, 59, 999)
|
||||
where.createdAt.lte = end
|
||||
}
|
||||
}
|
||||
|
||||
const [bugs, total] = await Promise.all([
|
||||
prisma.bug.findMany({
|
||||
@@ -852,10 +867,13 @@ export function createApp() {
|
||||
search: t.Optional(t.String({ description: 'Cari berdasarkan deskripsi, device, OS, atau versi' })),
|
||||
app: t.Optional(t.String({ description: 'Filter berdasarkan ID aplikasi, atau "all"' })),
|
||||
status: t.Optional(t.String({ description: 'Filter status: OPEN | ON_HOLD | IN_PROGRESS | RESOLVED | RELEASED | CLOSED | all' })),
|
||||
source: t.Optional(t.String({ description: 'Filter sumber: QC | SYSTEM | USER | all' })),
|
||||
dateFrom: t.Optional(t.String({ description: 'Filter dari tanggal (YYYY-MM-DD)' })),
|
||||
dateTo: t.Optional(t.String({ description: 'Filter sampai tanggal (YYYY-MM-DD)' })),
|
||||
}),
|
||||
detail: {
|
||||
summary: 'List Bug Reports',
|
||||
description: 'Mengembalikan daftar bug report dengan pagination, beserta data pelapor, gambar, dan riwayat status (BugLog). Mendukung filter berdasarkan aplikasi dan status.',
|
||||
description: 'Mengembalikan daftar bug report dengan pagination, beserta data pelapor, gambar, dan riwayat status (BugLog). Mendukung filter berdasarkan aplikasi, status, source, dan tanggal.',
|
||||
tags: ['Bugs'],
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user