fix: ticket
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// Admin services UI hits the same /admin/tickets endpoints as the messages
|
||||
// UI, scoped by ?type=service. Show/send/status reuse the admin-tickets
|
||||
// helpers since the URL pattern is identical.
|
||||
import { http } from '@/services/api/http'
|
||||
import { buildUrl, endpoints } from '@/services/api/endpoints'
|
||||
|
||||
export const apiGetAdminServices = (params) =>
|
||||
http.get(endpoints.getTicketsList, { params: { ...params, type: 'service' } })
|
||||
|
||||
export const apiShowAdminService = (id) => http.get(buildUrl(endpoints.showTicket, { id }))
|
||||
|
||||
export const apiSendAdminServiceMessage = (id, payload) =>
|
||||
http.post(buildUrl(endpoints.sendTicketMessage, { id }), payload)
|
||||
|
||||
export const apiChangeAdminServiceStatus = (id, payload) =>
|
||||
http.patch(buildUrl(endpoints.changeTicketStatus, { id }), payload)
|
||||
@@ -0,0 +1,14 @@
|
||||
import { http } from '@/services/api/http'
|
||||
import { buildUrl, endpoints } from '@/services/api/endpoints'
|
||||
|
||||
export const apiGetCounselorTickets = (params) =>
|
||||
http.get(endpoints.getCounselorTickets, { params })
|
||||
|
||||
export const apiShowCounselorTicket = (id) =>
|
||||
http.get(buildUrl(endpoints.showCounselorTicket, { id }))
|
||||
|
||||
export const apiSendCounselorTicketMessage = (id, payload) =>
|
||||
http.post(buildUrl(endpoints.sendCounselorTicketMessage, { id }), payload)
|
||||
|
||||
export const apiChangeCounselorTicketStatus = (id, payload) =>
|
||||
http.patch(buildUrl(endpoints.changeCounselorTicketStatus, { id }), payload)
|
||||
@@ -35,14 +35,12 @@ export const endpoints = {
|
||||
getMissionaryDispatches: '/student/missionary/dispatches',
|
||||
getMissionaryNarratives: '/student/missionary/narratives',
|
||||
|
||||
getStudentServices: '/student/services',
|
||||
createStudentService: '/student/services',
|
||||
getStudentServiceTypes: '/student/service-types',
|
||||
getStudentServiceTitles: '/student/service-titles',
|
||||
|
||||
getStudentConsultants: '/student/consultants',
|
||||
createStudentConsultant: '/student/consultants',
|
||||
getStudentConsultantTitles: '/student/consultant-titles',
|
||||
// Unified student tickets — handles services (type=service), consultants
|
||||
// (type=advise) and inbox (type=ticket) via the same endpoint with a filter.
|
||||
getStudentTickets: '/student/tickets',
|
||||
createStudentTicket: '/student/tickets',
|
||||
showStudentTicket: '/student/tickets/:id',
|
||||
sendStudentTicketMessage: '/student/tickets/:id/messages',
|
||||
|
||||
getStudentCertificates: '/student/certificates',
|
||||
downloadStudentCertificate: '/student/certificates/:id/download',
|
||||
@@ -140,18 +138,25 @@ export const endpoints = {
|
||||
showAssignmentSubmission: '/homework-submissions/:submissionId',
|
||||
|
||||
// ─── Backend-aligned: Tickets ─────────────────────────────────────────────
|
||||
// Admin "messages" UI talks to /admin/tickets.
|
||||
// Admin "consultations" UI talks to /counselor/tickets (same schema; the
|
||||
// counselor scope is the consultation pool).
|
||||
// Admin sees every type via /admin/tickets, filtered by ?type=:
|
||||
// - messages page → ?type=ticket
|
||||
// - services page → ?type=service
|
||||
// - consultations page → ?type=advise
|
||||
// Counselor is restricted to /counselor/tickets (advise-only at the backend).
|
||||
getTicketsList: '/admin/tickets',
|
||||
showTicket: '/admin/tickets/:id',
|
||||
sendTicketMessage: '/admin/tickets/:id/messages',
|
||||
changeTicketStatus: '/admin/tickets/:id/status',
|
||||
|
||||
getConsultationsList: '/counselor/tickets',
|
||||
showConsultation: '/counselor/tickets/:id',
|
||||
sendConsultationMessage: '/counselor/tickets/:id/messages',
|
||||
changeConsultationStatus: '/counselor/tickets/:id/status',
|
||||
getConsultationsList: '/admin/tickets',
|
||||
showConsultation: '/admin/tickets/:id',
|
||||
sendConsultationMessage: '/admin/tickets/:id/messages',
|
||||
changeConsultationStatus: '/admin/tickets/:id/status',
|
||||
|
||||
getCounselorTickets: '/counselor/tickets',
|
||||
showCounselorTicket: '/counselor/tickets/:id',
|
||||
sendCounselorTicketMessage: '/counselor/tickets/:id/messages',
|
||||
changeCounselorTicketStatus: '/counselor/tickets/:id/status',
|
||||
}
|
||||
|
||||
export const buildUrl = (template, params = {}) =>
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import { http } from '@/services/api/http'
|
||||
import { endpoints } from '@/services/api/endpoints'
|
||||
|
||||
export const apiGetStudentConsultants = (params) =>
|
||||
http.get(endpoints.getStudentConsultants, { params })
|
||||
|
||||
export const apiCreateStudentConsultant = (payload) =>
|
||||
http.post(endpoints.createStudentConsultant, payload)
|
||||
|
||||
export const apiGetStudentConsultantTitles = () => http.get(endpoints.getStudentConsultantTitles)
|
||||
@@ -1,12 +0,0 @@
|
||||
import { http } from '@/services/api/http'
|
||||
import { endpoints } from '@/services/api/endpoints'
|
||||
|
||||
export const apiGetStudentServices = (params) => http.get(endpoints.getStudentServices, { params })
|
||||
|
||||
export const apiCreateStudentService = (payload) =>
|
||||
http.post(endpoints.createStudentService, payload)
|
||||
|
||||
export const apiGetStudentServiceTypes = () => http.get(endpoints.getStudentServiceTypes)
|
||||
|
||||
export const apiGetStudentServiceTitles = (params) =>
|
||||
http.get(endpoints.getStudentServiceTitles, { params })
|
||||
@@ -0,0 +1,11 @@
|
||||
import { http } from '@/services/api/http'
|
||||
import { buildUrl, endpoints } from '@/services/api/endpoints'
|
||||
|
||||
export const apiGetStudentTickets = (params) => http.get(endpoints.getStudentTickets, { params })
|
||||
|
||||
export const apiShowStudentTicket = (id) => http.get(buildUrl(endpoints.showStudentTicket, { id }))
|
||||
|
||||
export const apiCreateStudentTicket = (payload) => http.post(endpoints.createStudentTicket, payload)
|
||||
|
||||
export const apiSendStudentTicketMessage = (id, payload) =>
|
||||
http.post(buildUrl(endpoints.sendStudentTicketMessage, { id }), payload)
|
||||
Reference in New Issue
Block a user