feat(api): 暴露电池 ORPC 契约
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
import { oc } from '@orpc/contract'
|
||||||
|
import { z } from 'zod'
|
||||||
|
import { batteriesResponseSchema, dashboardSnapshotSchema } from '@/domain/battery'
|
||||||
|
|
||||||
|
export const dashboard = oc.input(z.void()).output(dashboardSnapshotSchema)
|
||||||
|
|
||||||
|
export const batteries = oc
|
||||||
|
.input(
|
||||||
|
z.object({
|
||||||
|
mac: z.string().min(1).optional(),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.output(batteriesResponseSchema)
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as todo from './todo.contract'
|
import * as battery from './battery.contract'
|
||||||
|
|
||||||
export const contract = {
|
export const contract = {
|
||||||
todo,
|
battery,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Contract = typeof contract
|
export type Contract = typeof contract
|
||||||
|
|||||||
Reference in New Issue
Block a user