mirror of
https://github.com/complexcaresolutions/dak.c2s.git
synced 2026-03-17 17:13:42 +00:00
feat: add disclosure types and service functions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9825489781
commit
3e9448ab33
2 changed files with 48 additions and 0 deletions
23
frontend/src/services/disclosureService.ts
Normal file
23
frontend/src/services/disclosureService.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
import api from './api'
|
||||||
|
import type { DisclosureRequest, DisclosureCountResponse } from '@/types'
|
||||||
|
|
||||||
|
export async function requestDisclosure(caseId: number, reason: string): Promise<DisclosureRequest> {
|
||||||
|
const res = await api.post<DisclosureRequest>(`/cases/${caseId}/disclosure-request`, { reason })
|
||||||
|
return res.data
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getDisclosureRequests(status?: string): Promise<DisclosureRequest[]> {
|
||||||
|
const params = status ? { status } : {}
|
||||||
|
const res = await api.get<DisclosureRequest[]>('/admin/disclosure-requests', { params })
|
||||||
|
return res.data
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getDisclosureCount(): Promise<number> {
|
||||||
|
const res = await api.get<DisclosureCountResponse>('/admin/disclosure-requests/count')
|
||||||
|
return res.data.pending_count
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function reviewDisclosure(requestId: number, status: 'approved' | 'rejected'): Promise<DisclosureRequest> {
|
||||||
|
const res = await api.put<DisclosureRequest>(`/admin/disclosure-requests/${requestId}`, { status })
|
||||||
|
return res.data
|
||||||
|
}
|
||||||
|
|
@ -82,6 +82,8 @@ export interface Case {
|
||||||
import_source: string | null
|
import_source: string | null
|
||||||
imported_at: string
|
imported_at: string
|
||||||
updated_at: string
|
updated_at: string
|
||||||
|
disclosure_granted?: boolean
|
||||||
|
disclosure_expires_at?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CaseListResponse {
|
export interface CaseListResponse {
|
||||||
|
|
@ -279,3 +281,26 @@ export interface AuditLogEntry {
|
||||||
ip_address: string | null
|
ip_address: string | null
|
||||||
created_at: string
|
created_at: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disclosure Requests
|
||||||
|
export interface DisclosureRequest {
|
||||||
|
id: number
|
||||||
|
case_id: number
|
||||||
|
requester_id: number
|
||||||
|
requester_username: string | null
|
||||||
|
fall_id: string | null
|
||||||
|
reason: string
|
||||||
|
status: 'pending' | 'approved' | 'rejected'
|
||||||
|
reviewed_by: number | null
|
||||||
|
reviewed_at: string | null
|
||||||
|
expires_at: string | null
|
||||||
|
created_at: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DisclosureRequestCreate {
|
||||||
|
reason: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DisclosureCountResponse {
|
||||||
|
pending_count: number
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue