60e83d49dd
- Replace Vite boilerplate with React Router for page navigation - Add React Query for server state and cache management - Integrate shadcn/ui component library with Tailwind CSS v4 - Configure @/ path alias for clean module imports - Set up Vite dev proxy to API backend - Remove default App.css, App.tsx, and react.svg assets
83 lines
1.5 KiB
TypeScript
83 lines
1.5 KiB
TypeScript
// ---- Generic API result wrapper ----
|
|
export interface ApiResult<T> {
|
|
code: number
|
|
message: string
|
|
data: T | null
|
|
}
|
|
|
|
// ---- Auth ----
|
|
export interface UserLoginDto {
|
|
username: string
|
|
password: string
|
|
}
|
|
|
|
export interface LoginVo {
|
|
token: string
|
|
username: string
|
|
role: string
|
|
}
|
|
|
|
export type ApiResultLoginVo = ApiResult<LoginVo>
|
|
|
|
// ---- Book ----
|
|
export interface Book {
|
|
id: number | null
|
|
name: string
|
|
author: string
|
|
stock: number
|
|
}
|
|
|
|
export type ApiResultBook = ApiResult<Book>
|
|
export type ApiResultListBook = ApiResult<Book[]>
|
|
|
|
export interface BookAddDto {
|
|
name: string
|
|
author: string
|
|
stock: number
|
|
}
|
|
|
|
export interface BookUpdateDto {
|
|
name: string
|
|
author: string
|
|
}
|
|
|
|
// ---- Borrow / MyBorrow ----
|
|
export interface BookBorrowVo {
|
|
id: number
|
|
name: string
|
|
author: string
|
|
}
|
|
|
|
export interface MyBorrowVo {
|
|
id: number
|
|
bookBorrowVo: BookBorrowVo
|
|
borrowTime: string
|
|
returnTime: string | null
|
|
status: string
|
|
}
|
|
|
|
export type ApiResultMyBorrowVo = ApiResult<MyBorrowVo>
|
|
export type ApiResultListMyBorrowVo = ApiResult<MyBorrowVo[]>
|
|
|
|
// ---- Admin Borrow ----
|
|
export interface UserBorrowVo {
|
|
id: number
|
|
username: string
|
|
role: string
|
|
}
|
|
|
|
export interface BorrowInfoVo {
|
|
id: number
|
|
bookBorrowVo: BookBorrowVo
|
|
userBorrowVo: UserBorrowVo
|
|
borrowTime: string
|
|
returnTime: string | null
|
|
status: string
|
|
}
|
|
|
|
export type ApiResultBorrowInfoVo = ApiResult<BorrowInfoVo>
|
|
export type ApiResultListBorrowInfoVo = ApiResult<BorrowInfoVo[]>
|
|
|
|
// ---- Utils ----
|
|
export type ApiResultString = ApiResult<string | null>
|