From 6536c613179d035d065b001d68e452ee21ecc03a Mon Sep 17 00:00:00 2001 From: Clas Wen Date: Thu, 25 Sep 2025 23:18:33 +0800 Subject: [PATCH] use openapi fetch --- src/pages/repair/EventAction.tsx | 110 +- src/pages/repair/ExportEventDialog.tsx | 19 +- src/pages/repair/RepairAdmin.tsx | 21 +- src/pages/repair/TicketForm.tsx | 46 +- src/types/event.ts | 1 + src/types/saturday.d.ts | 1604 +++++++++++++++++++++--- 6 files changed, 1589 insertions(+), 212 deletions(-) diff --git a/src/pages/repair/EventAction.tsx b/src/pages/repair/EventAction.tsx index 950ee65..3e2db69 100644 --- a/src/pages/repair/EventAction.tsx +++ b/src/pages/repair/EventAction.tsx @@ -1,7 +1,7 @@ import type { UserInfoResponse } from "@logto/browser" import type { PublicMember } from "../../store/member" -import { EventStatus, type PublicEvent } from "../../types/event" -import { saturdayApiBaseUrl } from "../../utils/client" +import { EventStatus, type PublicEvent, type RepairEvent } from "../../types/event" +import { saturdayClient } from "../../utils/client" import { Button, Form, Select, SelectItem, Textarea } from "@heroui/react" import { useEffect, useState } from "react" @@ -20,7 +20,7 @@ export type EventActionProps = { event: PublicEvent identityContext: IdentityContext isLoading?: string - onUpdated: (event: PublicEvent) => void + onUpdated: (event: RepairEvent) => void onLoading: (loadingAction?: string) => void } @@ -104,19 +104,22 @@ export const EventActionCommit = (props: EventActionProps) => { const onSubmit = async () => { props.onLoading("commit") - const res = await fetch(`${saturdayApiBaseUrl}/member/events/${props.event.eventId}/commit`, { - method: "POST", - headers: { - Authorization: `Bearer ${props.identityContext.token}`, - ContentType: "application/json", + const { data } = await saturdayClient.POST("/member/events/{EventId}/commit", { + params: { + header: { + Authorization: `Bearer ${props.identityContext.token}`, + }, + path: { + EventId: props.event.eventId, + }, }, - body: JSON.stringify({ + body: { size: formData.size, content: formData.description, - }), - }).then(res => res.json()) + }, + }) props.onLoading() - return props.onUpdated(res) + return props.onUpdated(data) } return (
@@ -151,19 +154,22 @@ export const EventActionAlterCommit = (props: EventActionProps) => { const onSubmit = async () => { props.onLoading("alterCommit") - const res = await fetch(`${saturdayApiBaseUrl}/member/events/${props.event.eventId}/commit`, { - method: "PATCH", - headers: { - Authorization: `Bearer ${props.identityContext.token}`, - ContentType: "application/json", + const { data } = await saturdayClient.PATCH("/member/events/{EventId}/commit", { + params: { + header: { + Authorization: `Bearer ${props.identityContext.token}`, + }, + path: { + EventId: props.event.eventId, + }, }, - body: JSON.stringify({ + body: { size: formData.size, content: formData.description, - }), - }).then(res => res.json()) + }, + }) props.onLoading() - return props.onUpdated(res) + return props.onUpdated(data) } return (
@@ -206,7 +212,7 @@ export const getAvailableEventActions = (event: PublicEvent, identityContext: Id props.onLoading(action.action) if (action.handler) { const res = await action.handler() - props.onUpdated(res as PublicEvent) + props.onUpdated(res as RepairEvent) } props.onLoading() } @@ -235,12 +241,17 @@ export const getAvailableEventActions = (event: PublicEvent, identityContext: Id variant: "solid", color: "primary", handler: async () => { - return await fetch(`${saturdayApiBaseUrl}/member/events/${event.eventId}/accept`, { - method: "POST", - headers: { - Authorization: `Bearer ${identityContext.token}`, + const { data } = await saturdayClient.POST("/member/events/{EventId}/accept", { + params: { + header: { + Authorization: `Bearer ${identityContext.token}`, + }, + path: { + EventId: event.eventId, + }, }, - }).then(res => res.json()) + }) + return data }, }), }) @@ -256,12 +267,17 @@ export const getAvailableEventActions = (event: PublicEvent, identityContext: Id action: "drop", label: "放弃", handler: async () => { - return await fetch(`${saturdayApiBaseUrl}/member/events/${event.eventId}/accept`, { - method: "DELETE", - headers: { - Authorization: `Bearer ${identityContext.token}`, + const { data } = await saturdayClient.POST("/member/events/{EventId}/accept", { + params: { + header: { + Authorization: `Bearer ${identityContext.token}`, + }, + path: { + EventId: event.eventId, + }, }, - }).then(res => res.json()) + }) + return data }, }), }) @@ -281,12 +297,17 @@ export const getAvailableEventActions = (event: PublicEvent, identityContext: Id color: "success", label: "完成", handler: async () => { - return await fetch(`${saturdayApiBaseUrl}/events/${event.eventId}/close`, { - method: "POST", - headers: { - Authorization: `Bearer ${identityContext.token}`, + const { data } = await saturdayClient.POST("/events/{EventId}/close", { + params: { + header: { + Authorization: `Bearer ${identityContext.token}`, + }, + path: { + EventId: event.eventId, + }, }, - }).then(res => res.json()) + }) + return data }, }), }) @@ -297,12 +318,17 @@ export const getAvailableEventActions = (event: PublicEvent, identityContext: Id color: "danger", label: "退回", handler: async () => { - return await fetch(`${saturdayApiBaseUrl}/events/${event.eventId}/commit`, { - method: "DELETE", - headers: { - Authorization: `Bearer ${identityContext.token}`, + const { data } = await saturdayClient.DELETE("/events/{EventId}/commit", { + params: { + header: { + Authorization: `Bearer ${identityContext.token}`, + }, + path: { + EventId: event.eventId, + }, }, - }).then(res => res.json()) + }) + return data }, }), }) diff --git a/src/pages/repair/ExportEventDialog.tsx b/src/pages/repair/ExportEventDialog.tsx index 5c0d59b..b90cef2 100644 --- a/src/pages/repair/ExportEventDialog.tsx +++ b/src/pages/repair/ExportEventDialog.tsx @@ -9,7 +9,7 @@ import { DateRangePicker, } from "@heroui/react" import { parseDate } from "@internationalized/date" -import { saturdayApiBaseUrl } from "../../utils/client" +import { saturdayClient } from "../../utils/client" import { makeLogtoClient } from "../../utils/auth" import dayjs from "dayjs" @@ -29,15 +29,18 @@ export function ExportExcelModal() { setLoading(true) try { - const start = dateRange.start.toString() // Format: 'YYYY-MM-DD' - const end = dateRange.end.toString() - const url = `${saturdayApiBaseUrl}/events/xlsx?start_time=${start}&end_time=${end}` - const token = await makeLogtoClient().getAccessToken() - const response = await fetch(url, { - headers: { - Authorization: `Bearer ${token}`, + const { response } = await saturdayClient.GET("/events/xlsx", { + params: { + header: { + Authorization: `Bearer ${token}`, + }, + query: { + start_time: dateRange.start.toString(), + end_time: dateRange.end.toString(), + }, }, + parseAs: "stream", }) if (!response.ok) throw new Error("Download failed") diff --git a/src/pages/repair/RepairAdmin.tsx b/src/pages/repair/RepairAdmin.tsx index 7b5c30e..4374ebe 100644 --- a/src/pages/repair/RepairAdmin.tsx +++ b/src/pages/repair/RepairAdmin.tsx @@ -25,10 +25,10 @@ import { import { useCallback, useEffect, useMemo, useRef, useState } from "react" import { useAsyncList } from "@react-stately/data" import type { components } from "../../types/saturday" -import { saturdayApiBaseUrl, saturdayClient } from "../../utils/client" +import { saturdayClient } from "../../utils/client" import EventDetail, { EventStatusChip, type EventDetailRef } from "./EventDetail" import dayjs from "dayjs" -import { EventStatus, UserEventStatus } from "../../types/event" +import { EventStatus, UserEventStatus, type RepairEvent } from "../../types/event" import { makeLogtoClient } from "../../utils/auth" import type { PublicMember } from "../../store/member" import type { UserInfoResponse } from "@logto/browser" @@ -107,7 +107,7 @@ function TicketDetailDrawer(props: { event: PublicEvent identity: IdentityContext isOpen: boolean - onEventUpdated: (event: PublicEvent) => void + onEventUpdated: (event: RepairEvent) => void onOpenChange: (isOpen: boolean) => void onClose: () => void onDelete: () => void @@ -127,7 +127,7 @@ function TicketDetailDrawer(props: { setAvailableActions(getAvailableEventActions(props.event, props.identity)) }, [props.event, props.identity]) - const onEventUpdated = async (event: PublicEvent) => { + const onEventUpdated = async (event: RepairEvent) => { props.onEventUpdated(event) const res = await eventDetailRef.current?.refresh() console.log("onEventUpdated", res) @@ -216,13 +216,14 @@ export default function App() { } setUserInfo(res) - const currentMember = await fetch(`${saturdayApiBaseUrl}/member`, { - method: "GET", - headers: { - Authorization: `Bearer ${token}`, + const { data } = await saturdayClient.GET("/member", { + params: { + header: { + Authorization: `Bearer ${token}`, + }, }, - }).then(res => res.json()) - setCurrentMember(currentMember) + }) + setCurrentMember(data) } check() }, []) diff --git a/src/pages/repair/TicketForm.tsx b/src/pages/repair/TicketForm.tsx index 9c01c18..c1837b9 100644 --- a/src/pages/repair/TicketForm.tsx +++ b/src/pages/repair/TicketForm.tsx @@ -157,7 +157,7 @@ function TicketFormCreated(props: { }) return (
-
+
@@ -181,8 +181,10 @@ function TicketFormCreated(props: {
-
- +
+ + {() => <>} +
) @@ -204,23 +206,55 @@ export default function App() { setUserInfo(res) } check() + + // Check for eventId in URL query parameters + const urlParams = new URLSearchParams(window.location.search) + const eventId = urlParams.get("eventId") + if (eventId) { + // Fetch event data from the eventId + const fetchEvent = async () => { + try { + const { data } = await saturdayClient.GET("/events/{EventId}", { + params: { + path: { + EventId: parseInt(eventId, 10), + }, + }, + }) + if (data) { + setEvent(data as PublicEvent) + } + } + catch (error) { + console.log("Error fetching event:", error) + } + } + fetchEvent() + } }, []) const onSubmit = async (formData: TicketFormData) => { const logtoToken = await makeLogtoClient().getAccessToken() try { - const res = await saturdayClient.POST("/client/event", { + const { data } = await saturdayClient.POST("/client/event", { headers: { Authorization: `Bearer ${logtoToken}`, }, body: { - Problem: formData.description, + problem: formData.description, model: formData.model, phone: formData.phone, qq: formData.qq, }, }) - setEvent(res.data as unknown as PublicEvent) + setEvent(data as unknown as PublicEvent) + + // Update URL with eventId to persist the ticket status + if (data?.eventId) { + const currentUrl = new URL(window.location.href) + currentUrl.searchParams.set("eventId", data.eventId.toString()) + window.history.pushState({}, "", currentUrl.toString()) + } } catch (error) { console.log(error) diff --git a/src/types/event.ts b/src/types/event.ts index 5b31042..627c31d 100644 --- a/src/types/event.ts +++ b/src/types/event.ts @@ -80,3 +80,4 @@ export const UserEventAction: Action[] = [ ] export type PublicEvent = components["schemas"]["PublicEvent"] +export type RepairEvent = components["schemas"]["Event"] diff --git a/src/types/saturday.d.ts b/src/types/saturday.d.ts index a4a5884..6292ea4 100644 --- a/src/types/saturday.d.ts +++ b/src/types/saturday.d.ts @@ -4,6 +4,93 @@ */ export interface paths { + "/client/event": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Create client event */ + post: operations["create-client-event"] + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + "/client/events": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get client events by page */ + get: operations["get-client-events"] + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + "/client/events/{EventId}": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get client event by id */ + get: operations["get-client-event-by-id"] + put?: never + post?: never + /** Cancel client event */ + delete: operations["cancel-client-event"] + options?: never + head?: never + /** Update client event */ + patch: operations["update-client-event"] + trace?: never + } + "/clients/token/logto": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Create token via logto */ + post: operations["create-token-via-logto"] + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + "/clients/token/wechat": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Create token via wechat */ + post: operations["create-token-via-wechat"] + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } "/events": { parameters: { query?: never @@ -21,6 +108,23 @@ export interface paths { patch?: never trace?: never } + "/events/xlsx": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Export events to XLSX */ + get: operations["export-events-xlsx"] + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } "/events/{EventId}": { parameters: { query?: never @@ -38,6 +142,162 @@ export interface paths { patch?: never trace?: never } + "/events/{EventId}/close": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Close event */ + post: operations["close-event"] + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + "/events/{EventId}/commit": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + post?: never + /** Reject commit event */ + delete: operations["reject-commit-event"] + options?: never + head?: never + patch?: never + trace?: never + } + "/member": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get current member */ + get: operations["get-member"] + /** Update member */ + put: operations["update-member"] + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + "/member/activate": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + post?: never + delete?: never + options?: never + head?: never + /** Activate member */ + patch: operations["activate-member"] + trace?: never + } + "/member/avatar": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + post?: never + delete?: never + options?: never + head?: never + /** Update member avatar */ + patch: operations["update-member-avatar"] + trace?: never + } + "/member/events": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get member events */ + get: operations["get-member-events"] + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + "/member/events/{EventId}": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get member event by id */ + get: operations["get-member-event-by-id"] + put?: never + post?: never + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + "/member/events/{EventId}/accept": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Accept event */ + post: operations["accept-event"] + /** Drop event */ + delete: operations["drop-event"] + options?: never + head?: never + patch?: never + trace?: never + } + "/member/events/{EventId}/commit": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + /** Commit event */ + post: operations["commit-event"] + delete?: never + options?: never + head?: never + /** Alter commit event */ + patch: operations["alter-commit-event"] + trace?: never + } "/member/token/logto": { parameters: { query?: never @@ -65,6 +325,24 @@ export interface paths { /** Get a public member by page */ get: operations["get-public-member-by-page"] put?: never + /** Create multiple members */ + post: operations["create-members"] + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + "/members/full": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Get members with full details */ + get: operations["get-members-full"] + put?: never post?: never delete?: never options?: never @@ -82,11 +360,13 @@ export interface paths { /** Get a public member by id */ get: operations["get-public-member"] put?: never - post?: never + /** Create member */ + post: operations["create-member"] delete?: never options?: never head?: never - patch?: never + /** Update member basic info */ + patch: operations["update-member-basic"] trace?: never } "/members/{MemberId}/logto_id": { @@ -140,78 +420,128 @@ export interface paths { patch?: never trace?: never } - "clients/token/wechat": { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - get?: never - put?: never - /** Create token via wechat */ - post: operations["create-token-via-wechat"] - delete?: never - options?: never - head?: never - patch?: never - trace?: never - } } export type webhooks = Record export interface components { schemas: { + "ActivateMemberRequest": { + /** + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/ActivateMemberRequest.json + */ + readonly $schema?: string + MemberId: string + alias: string + password: string + phone: string + profile: string + qq: string + } + "AlterCommitEventInputBody": { + /** + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/AlterCommitEventInputBody.json + */ + readonly $schema?: string + content: string + size?: string + } "Bind-member-logto-idRequest": { /** - * Format: uri - * @description A URL to the JSON Schema for this object. - * @example https://example.com/schemas/Bind-member-logto-idRequest.json - */ + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/Bind-member-logto-idRequest.json + */ readonly $schema?: string password: string } "ClientTokenResponse": { /** - * Format: uri - * @description A URL to the JSON Schema for this object. - * @example https://example.com/schemas/ClientTokenResponse.json - */ + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/ClientTokenResponse.json + */ readonly $schema?: string /** Format: int64 */ clientId: number gmtCreate: string gmtModified: string + logtoId: string openid: string token: string } + "CommitEventInputBody": { + /** + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/CommitEventInputBody.json + */ + readonly $schema?: string + content: string + size?: string + } "Create-token-via-wechatRequest": { /** - * Format: uri - * @description A URL to the JSON Schema for this object. - * @example https://example.com/schemas/Create-token-via-wechatRequest.json - */ + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/Create-token-via-wechatRequest.json + */ readonly $schema?: string code: string } "Create-tokenRequest": { /** - * Format: uri - * @description A URL to the JSON Schema for this object. - * @example https://example.com/schemas/Create-tokenRequest.json - */ + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/Create-tokenRequest.json + */ readonly $schema?: string password: string } + "CreateClientEventInputBody": { + /** + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/CreateClientEventInputBody.json + */ + readonly $schema?: string + contactPreference?: string + model?: string + phone: string + problem: string + qq?: string + } + "CreateMemberRequest": { + /** + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/CreateMemberRequest.json + */ + readonly $schema?: string + alias: string + avatar: string + logtoId: string + memberId: string + name: string + phone: string + profile: string + qq: string + role: string + section: string + } "CreateMemberTokenResponse": { /** - * Format: uri - * @description A URL to the JSON Schema for this object. - * @example https://example.com/schemas/CreateMemberTokenResponse.json - */ + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/CreateMemberTokenResponse.json + */ readonly $schema?: string alias: string avatar: string createdBy: string + githubId: string gmtCreate: string gmtModified: string logtoId: string @@ -234,43 +564,71 @@ export interface components { } "ErrorModel": { /** - * Format: uri - * @description A URL to the JSON Schema for this object. - * @example https://example.com/schemas/ErrorModel.json - */ + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/ErrorModel.json + */ readonly $schema?: string /** - * @description A human-readable explanation specific to this occurrence of the problem. - * @example Property foo is required but is missing. - */ + * @description A human-readable explanation specific to this occurrence of the problem. + * @example Property foo is required but is missing. + */ detail?: string /** @description Optional list of individual error details */ - errors?: components["schemas"]["ErrorDetail"][] + errors?: components["schemas"]["ErrorDetail"][] | null /** - * Format: uri - * @description A URI reference that identifies the specific occurrence of the problem. - * @example https://example.com/error-log/abc123 - */ + * Format: uri + * @description A URI reference that identifies the specific occurrence of the problem. + * @example https://example.com/error-log/abc123 + */ instance?: string /** - * Format: int64 - * @description HTTP status code - * @example 400 - */ + * Format: int64 + * @description HTTP status code + * @example 400 + */ status?: number /** - * @description A short, human-readable summary of the problem type. This value should not change between occurrences of the error. - * @example Bad Request - */ + * @description A short, human-readable summary of the problem type. This value should not change between occurrences of the error. + * @example Bad Request + */ title?: string /** - * Format: uri - * @description A URI reference to human-readable documentation for the error. - * @default about:blank - * @example https://example.com/errors/example - */ + * Format: uri + * @description A URI reference to human-readable documentation for the error. + * @default about:blank + * @example https://example.com/errors/example + */ type: string } + "Event": { + /** + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/Event.json + */ + readonly $schema?: string + /** Format: int64 */ + clientId: number + closedBy: components["schemas"]["PublicMember"] + closedById: string + contactPreference: string + /** Format: int64 */ + eventId: number + githubIssueId: components["schemas"]["NullInt64"] + githubIssueNumber: components["schemas"]["NullInt64"] + gmtCreate: string + gmtModified: string + logs: components["schemas"]["EventLog"][] | null + member: components["schemas"]["PublicMember"] + memberId: string + model: string + phone: string + problem: string + qq: string + size: string + status: string + } "EventLog": { action: string description: string @@ -281,14 +639,15 @@ export interface components { } "Member": { /** - * Format: uri - * @description A URL to the JSON Schema for this object. - * @example https://example.com/schemas/Member.json - */ + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/Member.json + */ readonly $schema?: string alias: string avatar: string createdBy: string + githubId: string gmtCreate: string gmtModified: string logtoId: string @@ -300,45 +659,55 @@ export interface components { role: string section: string } + "NullInt64": { + /** Format: int64 */ + Int64: number + Valid: boolean + } "PingResponse": { /** - * Format: uri - * @description A URL to the JSON Schema for this object. - * @example https://example.com/schemas/PingResponse.json - */ + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/PingResponse.json + */ readonly $schema?: string /** - * @description Ping message - * @example ping - */ + * @description Ping message + * @example ping + */ message: string } "PublicEvent": { /** - * Format: uri - * @description A URL to the JSON Schema for this object. - * @example https://example.com/schemas/PublicEvent.json - */ + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/PublicEvent.json + */ readonly $schema?: string /** Format: int64 */ clientId: number closedBy: components["schemas"]["PublicMember"] /** Format: int64 */ eventId: number + /** Format: int64 */ + githubIssueId: number + /** Format: int64 */ + githubIssueNumber: number gmtCreate: string gmtModified: string - logs: components["schemas"]["EventLog"][] + logs: components["schemas"]["EventLog"][] | null member: components["schemas"]["PublicMember"] model: string problem: string + size: string status: string } "PublicMember": { /** - * Format: uri - * @description A URL to the JSON Schema for this object. - * @example https://example.com/schemas/PublicMember.json - */ + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/PublicMember.json + */ readonly $schema?: string alias: string avatar: string @@ -349,6 +718,57 @@ export interface components { profile: string role: string } + "UpdateClientEventInputBody": { + /** + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/UpdateClientEventInputBody.json + */ + readonly $schema?: string + contactPreference?: string + model?: string + phone: string + problem: string + qq?: string + size?: string + } + "UpdateMemberAvatarInputBody": { + /** + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/UpdateMemberAvatarInputBody.json + */ + readonly $schema?: string + /** @description Avatar URL */ + avatar: string + } + "UpdateMemberBasicRequest": { + /** + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/UpdateMemberBasicRequest.json + */ + readonly $schema?: string + memberId: string + name: string + role: string + section: string + } + "UpdateMemberRequest": { + /** + * Format: uri + * @description A URL to the JSON Schema for this object. + * @example https://api.nbtca.space/schemas/UpdateMemberRequest.json + */ + readonly $schema?: string + MemberId: string + alias: string + avatar: string + password: string + phone: string + profile: string + qq: string + } } responses: never parameters: never @@ -358,18 +778,282 @@ export interface components { } export type $defs = Record export interface operations { + "create-client-event": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path?: never + cookie?: never + } + requestBody: { + content: { + "application/json": components["schemas"]["CreateClientEventInputBody"] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "get-client-events": { + parameters: { + query?: { + /** + * @description Offset + * @example 0 + */ + offset?: number + /** + * @description Limit + * @example 50 + */ + limit?: number + status?: string + order?: string + } + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"][] | null + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "get-client-event-by-id": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path: { + /** + * @description Event ID + * @example 123 + */ + EventId: number + } + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "cancel-client-event": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path: { + /** + * @description Event ID + * @example 123 + */ + EventId: number + } + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "update-client-event": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path: { + /** + * @description Event ID + * @example 123 + */ + EventId: number + } + cookie?: never + } + requestBody: { + content: { + "application/json": components["schemas"]["UpdateClientEventInputBody"] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "create-token-via-logto": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["ClientTokenResponse"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "create-token-via-wechat": { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + requestBody: { + content: { + "application/json": components["schemas"]["Create-token-via-wechatRequest"] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["ClientTokenResponse"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } "get-public-event-by-page": { parameters: { query?: { /** - * @description Offset - * @example 0 - */ + * @description Offset + * @example 0 + */ offset?: number /** - * @description Limit - * @example 50 - */ + * @description Limit + * @example 50 + */ limit?: number status?: string order?: string @@ -386,7 +1070,7 @@ export interface operations { [name: string]: unknown } content: { - "application/json": components["schemas"]["PublicEvent"][] + "application/json": components["schemas"]["PublicEvent"][] | null } } /** @description Error */ @@ -400,6 +1084,51 @@ export interface operations { } } } + "export-events-xlsx": { + parameters: { + query: { + /** + * @description Offset + * @example 0 + */ + offset?: number + /** + * @description Limit + * @example 50 + */ + limit?: number + status?: string + order?: string + start_time: string + end_time: string + } + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } "get-public-event-by-id": { parameters: { query?: never @@ -431,19 +1160,472 @@ export interface operations { } } } + "close-event": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path: { + /** + * @description Event ID + * @example 123 + */ + EventId: number + } + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "reject-commit-event": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path: { + /** + * @description Event ID + * @example 123 + */ + EventId: number + } + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "get-member": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Member"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "update-member": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path?: never + cookie?: never + } + requestBody: { + content: { + "application/json": components["schemas"]["UpdateMemberRequest"] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Member"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "activate-member": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path?: never + cookie?: never + } + requestBody: { + content: { + "application/json": components["schemas"]["ActivateMemberRequest"] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Member"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "update-member-avatar": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path?: never + cookie?: never + } + requestBody: { + content: { + "application/json": components["schemas"]["UpdateMemberAvatarInputBody"] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Member"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "get-member-events": { + parameters: { + query?: { + /** + * @description Offset + * @example 0 + */ + offset?: number + /** + * @description Limit + * @example 50 + */ + limit?: number + status?: string + order?: string + } + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"][] | null + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "get-member-event-by-id": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path: { + /** + * @description Event ID + * @example 123 + */ + EventId: number + } + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "accept-event": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path: { + /** + * @description Event ID + * @example 123 + */ + EventId: number + } + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "drop-event": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path: { + /** + * @description Event ID + * @example 123 + */ + EventId: number + } + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "commit-event": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path: { + /** + * @description Event ID + * @example 123 + */ + EventId: number + } + cookie?: never + } + requestBody: { + content: { + "application/json": components["schemas"]["CommitEventInputBody"] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "alter-commit-event": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path: { + /** + * @description Event ID + * @example 123 + */ + EventId: number + } + cookie?: never + } + requestBody: { + content: { + "application/json": components["schemas"]["AlterCommitEventInputBody"] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Event"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } "create-token-via-logto-token": { parameters: { query?: never header?: { Authorization?: string } - path: { - /** - * @description Member Id - * @example 2333333333 - */ - MemberId: string - } + path?: never cookie?: never } requestBody?: never @@ -472,14 +1654,14 @@ export interface operations { parameters: { query?: { /** - * @description Offset - * @example 0 - */ + * @description Offset + * @example 0 + */ offset?: number /** - * @description Limit - * @example 50 - */ + * @description Limit + * @example 50 + */ limit?: number } header?: never @@ -494,7 +1676,86 @@ export interface operations { [name: string]: unknown } content: { - "application/json": components["schemas"]["PublicMember"][] + "application/json": components["schemas"]["PublicMember"][] | null + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "create-members": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path?: never + cookie?: never + } + requestBody: { + content: { + "application/json": components["schemas"]["CreateMemberRequest"][] | null + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Member"][] | null + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "get-members-full": { + parameters: { + query?: { + /** + * @description Offset + * @example 0 + */ + offset?: number + /** + * @description Limit + * @example 50 + */ + limit?: number + } + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path?: never + cookie?: never + } + requestBody?: never + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Member"][] | null } } /** @description Error */ @@ -514,9 +1775,9 @@ export interface operations { header?: never path: { /** - * @description Name to greet - * @example 2333333333 - */ + * @description Name to greet + * @example 2333333333 + */ MemberId: string } cookie?: never @@ -543,6 +1804,90 @@ export interface operations { } } } + "create-member": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path: { + /** + * @description Member ID + * @example 2333333333 + */ + MemberId: string + } + cookie?: never + } + requestBody: { + content: { + "application/json": components["schemas"]["CreateMemberRequest"] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Member"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } + "update-member-basic": { + parameters: { + query?: never + header?: { + /** @description Bearer token or JWT token */ + Authorization?: string + } + path: { + /** + * @description Member ID + * @example 2333333333 + */ + MemberId: string + } + cookie?: never + } + requestBody: { + content: { + "application/json": components["schemas"]["UpdateMemberBasicRequest"] + } + } + responses: { + /** @description OK */ + 200: { + headers: { + [name: string]: unknown + } + content: { + "application/json": components["schemas"]["Member"] + } + } + /** @description Error */ + default: { + headers: { + [name: string]: unknown + } + content: { + "application/problem+json": components["schemas"]["ErrorModel"] + } + } + } + } "bind-member-logto-id": { parameters: { query?: never @@ -551,9 +1896,9 @@ export interface operations { } path: { /** - * @description Member Id - * @example 2333333333 - */ + * @description Member Id + * @example 2333333333 + */ MemberId: string } cookie?: never @@ -590,9 +1935,9 @@ export interface operations { header?: never path: { /** - * @description Member Id - * @example 2333333333 - */ + * @description Member Id + * @example 2333333333 + */ MemberId: string } cookie?: never @@ -652,37 +1997,4 @@ export interface operations { } } } - "create-token-via-wechat": { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - requestBody: { - content: { - "application/json": components["schemas"]["Create-token-via-wechatRequest"] - } - } - responses: { - /** @description OK */ - 200: { - headers: { - [name: string]: unknown - } - content: { - "application/json": components["schemas"]["ClientTokenResponse"] - } - } - /** @description Error */ - default: { - headers: { - [name: string]: unknown - } - content: { - "application/problem+json": components["schemas"]["ErrorModel"] - } - } - } - } }