feat(system): SID rules/lucky-numbers/assign, locales CRUD, devices list, robot session tokens
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
import { api } from '@/api/client'
|
||||
import type { ListParams, NotificationDevice, PaginatedResponse } from '@/api/types'
|
||||
|
||||
export function fetchDevices(params: ListParams) {
|
||||
return api.get<PaginatedResponse<NotificationDevice>>('/api/admin/v1/notification/devices', params)
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { api } from '@/api/client'
|
||||
import type { ApiResponse, LocaleRow } from '@/api/types'
|
||||
|
||||
const BASE = '/api/admin/v1/locales'
|
||||
|
||||
export interface LocalePayload {
|
||||
code?: string
|
||||
name: string
|
||||
native_name: string
|
||||
is_active?: boolean
|
||||
sort_order?: number
|
||||
}
|
||||
|
||||
export function fetchLocales() {
|
||||
return api.get<ApiResponse<LocaleRow[]>>(BASE)
|
||||
}
|
||||
|
||||
export function createLocale(payload: LocalePayload) {
|
||||
return api.post<ApiResponse<LocaleRow>>(BASE, payload)
|
||||
}
|
||||
|
||||
export function updateLocale(code: string, payload: Partial<LocalePayload>) {
|
||||
return api.put<ApiResponse<LocaleRow>>(`${BASE}/${code}`, payload)
|
||||
}
|
||||
|
||||
export function deleteLocale(code: string) {
|
||||
return api.delete<ApiResponse<null>>(`${BASE}/${code}`)
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { api } from '@/api/client'
|
||||
import type { ApiResponse, LuckyNumber, SidCheckResult, SidRule } from '@/api/types'
|
||||
|
||||
const BASE = '/api/admin/v1/sid'
|
||||
|
||||
export function fetchSidRules() {
|
||||
return api.get<ApiResponse<SidRule[]>>(`${BASE}/rules`)
|
||||
}
|
||||
|
||||
export function updateSidRule(key: string, payload: { enabled: boolean; description?: string | null }) {
|
||||
return api.put<ApiResponse<SidRule>>(`${BASE}/rules/${key}`, payload)
|
||||
}
|
||||
|
||||
export function fetchLuckyNumbers() {
|
||||
return api.get<ApiResponse<LuckyNumber[]>>(`${BASE}/lucky-numbers`)
|
||||
}
|
||||
|
||||
export function createLuckyNumber(payload: { number: string; category?: string | null; enabled?: boolean }) {
|
||||
return api.post<ApiResponse<LuckyNumber>>(`${BASE}/lucky-numbers`, payload)
|
||||
}
|
||||
|
||||
export function updateLuckyNumber(
|
||||
id: number,
|
||||
payload: { category?: string | null; enabled?: boolean },
|
||||
) {
|
||||
return api.put<ApiResponse<LuckyNumber>>(`${BASE}/lucky-numbers/${id}`, payload)
|
||||
}
|
||||
|
||||
export function deleteLuckyNumber(id: number) {
|
||||
return api.delete<ApiResponse<null>>(`${BASE}/lucky-numbers/${id}`)
|
||||
}
|
||||
|
||||
export function checkSid(sid: string) {
|
||||
return api.post<ApiResponse<SidCheckResult>>(`${BASE}/check`, { sid })
|
||||
}
|
||||
|
||||
export function assignSid(userUid: string, sid: string) {
|
||||
return api.post<ApiResponse<unknown>>(`${BASE}/assign`, { user_uid: userUid, sid })
|
||||
}
|
||||
Reference in New Issue
Block a user