refactor(types): align entity types with backend API responses

Adjust all entity types to match actual backend response shapes.
String-typed numeric fields (Shop.rating, Shop.commissionValue,
WalletTransaction.amount) now correctly typed as strings.
Post.linkedOrderId changed from SnowflakeId to number (backend int64).
Removed fields absent from backend: Order consumer/player/shopName,
Review fromUserAvatar/toUserId, Dispute initiatorId/initiatorName,
Post authorRole/quotedPostId, Comment postId, ChatSession
readonly/lastMessageAt, ChatMessage senderName/senderAvatar.
Added Player.gender field.
This commit is contained in:
zetaloop
2026-04-23 21:14:46 +08:00
parent d0985a91b8
commit ca4bef959f
5 changed files with 38 additions and 40 deletions
+16 -24
View File
@@ -9,7 +9,6 @@ export type VerificationStatus = "pending" | "approved" | "rejected"
export interface User {
id: SnowflakeId
username: string
email?: string
nickname: string
avatar: string
role: UserRole
@@ -24,7 +23,7 @@ export interface Game {
id: SnowflakeId
name: string
icon: string
category: "MOBA" | "FPS" | "动作" | "RPG"
category: string
}
export interface PlayerService {
@@ -51,6 +50,7 @@ export interface Player {
services: PlayerService[]
shopId?: SnowflakeId
shopName?: string
gender: boolean
tags: string[]
}
@@ -60,11 +60,11 @@ export interface Shop {
name: string
banner?: string
description: string
rating: number
rating: string
totalOrders: number
playerCount: number
commissionType: "fixed" | "percentage"
commissionValue: number
commissionValue: string
allowMultiShop: boolean
allowIndependentOrders: boolean
dispatchMode: "manual" | "auto"
@@ -95,18 +95,14 @@ export type OrderStatus =
export interface Order {
id: SnowflakeId
consumerId: SnowflakeId
consumerName: string
playerId: SnowflakeId
playerName: string
shopId?: SnowflakeId
shopName?: string
service: PlayerService
status: OrderStatus
totalPrice: number
note?: string
createdAt: string
acceptedAt?: string
closedAt?: string
completedAt?: string
}
@@ -115,10 +111,8 @@ export interface Review {
orderId: SnowflakeId
fromUserId: SnowflakeId
fromUserName: string
fromUserAvatar: string
toUserId: SnowflakeId
rating: number
content?: string
content: string
sealed: boolean
createdAt: string
}
@@ -126,8 +120,6 @@ export interface Review {
export interface Dispute {
id: SnowflakeId
orderId: SnowflakeId
initiatorId: SnowflakeId
initiatorName: string
reason: string
evidence: string[]
status: "open" | "reviewing" | "resolved" | "appealed"
@@ -135,13 +127,17 @@ export interface Dispute {
createdAt: string
}
export interface ChatParticipant {
id: SnowflakeId
nickname: string
avatar: string
}
interface BaseChatSession {
id: SnowflakeId
participants: { id: SnowflakeId; name: string; avatar: string }[]
participants: ChatParticipant[]
lastMessage?: string
lastMessageAt?: string
unreadCount: number
readonly: boolean
}
export interface OrderChatSession extends BaseChatSession {
@@ -160,8 +156,6 @@ export interface ChatMessage {
id: SnowflakeId
sessionId: SnowflakeId
senderId: SnowflakeId
senderName: string
senderAvatar: string
type: "text" | "image" | "system"
content: string
createdAt: string
@@ -170,23 +164,20 @@ export interface ChatMessage {
export interface Post {
id: SnowflakeId
author: User
authorRole: UserRole
title: string
content: string
images: string[]
tags: string[]
linkedOrderId?: SnowflakeId
quotedPostId?: SnowflakeId
linkedOrderId?: number
pinned: boolean
likeCount: number
commentCount: number
liked: boolean
pinned: boolean
createdAt: string
}
export interface Comment {
id: SnowflakeId
postId: SnowflakeId
author: User
content: string
likeCount: number
@@ -207,8 +198,9 @@ export interface Notification {
export interface WalletTransaction {
id: SnowflakeId
type: "topup" | "payment" | "income" | "withdrawal" | "refund"
amount: number
amount: string
description: string
orderId?: string
createdAt: string
}