fix: tickets
Deploy banu-front / deploy (push) Failing after 16s

This commit is contained in:
sajjadtalkhabi
2026-06-05 19:42:09 +03:30
parent ea562aeefa
commit b8ccbcc030
24 changed files with 447 additions and 222 deletions
@@ -18,6 +18,21 @@ register('GET', endpoints.getStudentTickets, ({ query }) => {
return { success: true, message: 'OK', data: items, meta }
})
register('GET', endpoints.getStudentTicketStats, ({ query }) => {
const scoped = query.type ? myPool().filter((t) => t.type === query.type) : myPool()
const countBy = (status) => scoped.filter((t) => t.status === status).length
return {
success: true,
message: 'OK',
data: {
openTickets: countBy('open'),
answeredTickets: countBy('answered'),
closedTickets: countBy('closed'),
all: scoped.length,
},
}
})
register('GET', endpoints.showStudentTicket, ({ params }) => ({
success: true,
message: 'OK',
@@ -32,6 +47,7 @@ register('POST', endpoints.createStudentTicket, ({ data }) => {
assignedToUserId: null,
type: data.type || 'ticket',
category: data.category || null,
priority: data.priority || null,
status: 'open',
subject: data.subject || '',
createdAt: isoNow(),
@@ -60,6 +76,7 @@ register('POST', endpoints.createStudentTicket, ({ data }) => {
assignedToUserId: ticket.assignedToUserId,
type: ticket.type,
category: ticket.category,
priority: ticket.priority,
status: ticket.status,
subject: ticket.subject,
createdAt: ticket.createdAt,