syntax = "v1" import "common.api" // 照片管理接口 // 获取照片列表请求 type GetPhotoListRequest { PageRequest CategoryId int64 `form:"category_id,optional"` UserId int64 `form:"user_id,optional"` Keyword string `form:"keyword,optional"` } // 获取照片列表响应 type GetPhotoListResponse { BaseResponse Data PhotoListData `json:"data"` } type PhotoListData { PageResponse Photos []Photo `json:"photos"` } // 获取照片详情请求 type GetPhotoRequest { Id int64 `path:"id"` } // 获取照片详情响应 type GetPhotoResponse { BaseResponse Data Photo `json:"data"` } // 上传照片请求 type UploadPhotoRequest { Title string `json:"title" validate:"required"` Description string `json:"description,optional"` CategoryId int64 `json:"category_id" validate:"required"` } // 上传照片响应 type UploadPhotoResponse { BaseResponse Data Photo `json:"data"` } // 更新照片请求 type UpdatePhotoRequest { Id int64 `path:"id"` Title string `json:"title,optional"` Description string `json:"description,optional"` CategoryId int64 `json:"category_id,optional"` } // 更新照片响应 type UpdatePhotoResponse { BaseResponse Data Photo `json:"data"` } // 删除照片请求 type DeletePhotoRequest { Id int64 `path:"id"` } // 删除照片响应 type DeletePhotoResponse { BaseResponse } // 照片管理接口组 @server( group: photo prefix: /api/v1/photos jwt: Auth ) service photography-api { @doc "获取照片列表" @handler getPhotoList get / (GetPhotoListRequest) returns (GetPhotoListResponse) @doc "上传照片" @handler uploadPhoto post / (UploadPhotoRequest) returns (UploadPhotoResponse) @doc "获取照片详情" @handler getPhoto get /:id (GetPhotoRequest) returns (GetPhotoResponse) @doc "更新照片" @handler updatePhoto put /:id (UpdatePhotoRequest) returns (UpdatePhotoResponse) @doc "删除照片" @handler deletePhoto delete /:id (DeletePhotoRequest) returns (DeletePhotoResponse) }