添加研究实习项目api文件
This commit is contained in:
136
server/api/social_service_internship.api
Normal file
136
server/api/social_service_internship.api
Normal file
@@ -0,0 +1,136 @@
|
||||
// 通用基础响应结构(不含泛型,兼容Goctl)
|
||||
type BaseResp {
|
||||
Code int `json:"code"` // 状态码:0成功,非0失败
|
||||
Msg string `json:"message"` // 提示信息
|
||||
}
|
||||
|
||||
// 社会服务实习实体结构(与表字段对应)
|
||||
type SocialServiceInternship {
|
||||
Id int64 `json:"id"` // 主键ID
|
||||
Title string `json:"title"` // 标题
|
||||
Subtitle string `json:"subtitle,omitempty"` // 副标题
|
||||
CoverUrl string `json:"cover_url,omitempty"` // 封面图片URL
|
||||
Intro string `json:"intro,omitempty"` // 简介(纯文字)
|
||||
Content string `json:"content,omitempty"` // 内容(Markdown格式)
|
||||
ImageEditors string `json:"image_editors,omitempty"` // 图片编辑者名单(逗号分隔)
|
||||
TextEditors string `json:"text_editors,omitempty"` // 文字编辑者名单(逗号分隔)
|
||||
ChiefEditor string `json:"chief_editor,omitempty"` // 总编辑
|
||||
Proofreaders string `json:"proofreaders,omitempty"` // 校对者名单(逗号分隔)
|
||||
Reviewers string `json:"reviewers,omitempty"` // 审核者名单(逗号分隔)
|
||||
PublishTime string `json:"publish_time"` // 发布时间(格式:yyyy-MM-dd HH:mm:ss)
|
||||
UpdateTime string `json:"update_time"` // 最后更改时间(格式:yyyy-MM-dd HH:mm:ss)
|
||||
}
|
||||
|
||||
// 创建社会服务实习 - 请求参数
|
||||
type CreateSocialServiceInternshipReq {
|
||||
Title string `json:"title" validate:"required"` // 标题(必填)
|
||||
Subtitle string `json:"subtitle,omitempty"` // 副标题
|
||||
CoverUrl string `json:"cover_url,omitempty"` // 封面图片URL
|
||||
Intro string `json:"intro,omitempty"` // 简介(纯文字)
|
||||
Content string `json:"content,omitempty"` // 内容(Markdown格式)
|
||||
ImageEditors string `json:"image_editors,omitempty"` // 图片编辑者名单(逗号分隔)
|
||||
TextEditors string `json:"text_editors,omitempty"` // 文字编辑者名单(逗号分隔)
|
||||
ChiefEditor string `json:"chief_editor,omitempty"` // 总编辑
|
||||
Proofreaders string `json:"proofreaders,omitempty"` // 校对者名单(逗号分隔)
|
||||
Reviewers string `json:"reviewers,omitempty"` // 审核者名单(逗号分隔)
|
||||
}
|
||||
|
||||
// 创建社会服务实习 - 响应参数(嵌套数据,无泛型)
|
||||
type CreateSocialServiceInternshipResp {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"message"`
|
||||
Data CreateSocialServiceInternshipData `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
type CreateSocialServiceInternshipData {
|
||||
Id int64 `json:"id"` // 新增记录的ID
|
||||
}
|
||||
|
||||
// 获取社会服务实习列表 - 请求参数
|
||||
type ListSocialServiceInternshipReq {
|
||||
Page int `json:"page" form:"page" validate:"min=1"` // 页码(默认1)
|
||||
PageSize int `json:"page_size" form:"page_size" validate:"min=1,max=100"` // 每页条数(默认10,最大100)
|
||||
}
|
||||
|
||||
// 获取社会服务实习列表 - 响应参数(嵌套数据,无泛型)
|
||||
type ListSocialServiceInternshipResp {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"message"`
|
||||
Data ListSocialServiceInternshipData `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
type ListSocialServiceInternshipData {
|
||||
Total int64 `json:"total"` // 总条数
|
||||
List []SocialServiceInternship `json:"list"` // 列表数据
|
||||
}
|
||||
|
||||
// 获取社会服务实习详情 - 请求参数(路径参数)
|
||||
type GetSocialServiceInternshipReq {
|
||||
Id int64 `json:"id" path:"id" validate:"min=1"` // 社会服务实习ID(必填)
|
||||
}
|
||||
|
||||
// 获取社会服务实习详情 - 响应参数(嵌套数据,无泛型)
|
||||
type GetSocialServiceInternshipResp {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"message"`
|
||||
Data SocialServiceInternship `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
// 更新社会服务实习 - 请求参数
|
||||
type UpdateSocialServiceInternshipReq {
|
||||
Id int64 `json:"-" path:"id" validate:"min=1"` // 社会服务实习ID(路径参数,必填)
|
||||
Title string `json:"title,omitempty"` // 标题
|
||||
Subtitle string `json:"subtitle,omitempty"` // 副标题
|
||||
CoverUrl string `json:"cover_url,omitempty"` // 封面图片URL
|
||||
Intro string `json:"intro,omitempty"` // 简介(纯文字)
|
||||
Content string `json:"content,omitempty"` // 内容(Markdown格式)
|
||||
ImageEditors string `json:"image_editors,omitempty"` // 图片编辑者名单(逗号分隔)
|
||||
TextEditors string `json:"text_editors,omitempty"` // 文字编辑者名单(逗号分隔)
|
||||
ChiefEditor string `json:"chief_editor,omitempty"` // 总编辑
|
||||
Proofreaders string `json:"proofreaders,omitempty"` // 校对者名单(逗号分隔)
|
||||
Reviewers string `json:"reviewers,omitempty"` // 审核者名单(逗号分隔)
|
||||
}
|
||||
|
||||
// 更新社会服务实习 - 响应参数(基础响应,无额外数据)
|
||||
type UpdateSocialServiceInternshipResp {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"message"`
|
||||
}
|
||||
|
||||
// 删除社会服务实习 - 请求参数(路径参数)
|
||||
type DeleteSocialServiceInternshipReq {
|
||||
Id int64 `json:"id" path:"id" validate:"min=1"` // 社会服务实习ID(必填)
|
||||
}
|
||||
|
||||
// 删除社会服务实习 - 响应参数(基础响应,无额外数据)
|
||||
type DeleteSocialServiceInternshipResp {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"message"`
|
||||
}
|
||||
|
||||
@server (
|
||||
group: socialServiceInternship
|
||||
prefix: /api/social-service/internship // 统一前缀,区分实习相关接口
|
||||
)
|
||||
service social_service_internship_api {
|
||||
// 创建社会服务实习
|
||||
@handler CreateSocialServiceInternshipHandler
|
||||
post / (CreateSocialServiceInternshipReq) returns (CreateSocialServiceInternshipResp)
|
||||
|
||||
// 获取社会服务实习列表
|
||||
@handler ListSocialServiceInternshipHandler
|
||||
get /list (ListSocialServiceInternshipReq) returns (ListSocialServiceInternshipResp)
|
||||
|
||||
// 获取社会服务实习详情
|
||||
@handler GetSocialServiceInternshipHandler
|
||||
get /:id (GetSocialServiceInternshipReq) returns (GetSocialServiceInternshipResp)
|
||||
|
||||
// 更新社会服务实习
|
||||
@handler UpdateSocialServiceInternshipHandler
|
||||
put /:id (UpdateSocialServiceInternshipReq) returns (UpdateSocialServiceInternshipResp)
|
||||
|
||||
// 删除社会服务实习
|
||||
@handler DeleteSocialServiceInternshipHandler
|
||||
delete /:id (DeleteSocialServiceInternshipReq) returns (DeleteSocialServiceInternshipResp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user