Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct {
// contains filtered or unexported fields
}
func NewArticle ¶
func NewArticle(db *gorm.DB, cfg *setting.Configuration) Article
func (*Article) Create ¶
@Summary 创建文章 @Produce json @Param tag_id body string true "标签ID" @Param title body string true "文章标题" @Param desc body string false "文章简述" @Param cover_image_url body string true "封面图片地址" @Param content body string true "文章内容" @Param created_by body int true "创建者" @Param state body int false "状态" @Success 200 {object} string "成功" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /api/v1/articles [post].
func (*Article) Delete ¶
@Summary 删除文章 @Produce json @Param id path int true "文章ID" @Success 200 {string} string "成功" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /api/v1/articles/{id} [delete].
func (*Article) Get ¶
@Summary 获取单个文章 @Produce json @Param id path int true "文章ID" @Success 200 {object} entity.ArticleEntity "成功" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /api/v1/articles/{id} [get].
func (*Article) List ¶
@Summary 获取多个文章 @Produce json @Param name query string false "文章名称" @Param tag_id query int false "标签ID" @Param state query int false "状态" @Param page query int false "页码" @Param page_size query int false "每页数量" @Success 200 {object} app.ListResponse "成功" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /api/v1/articles [get].
func (*Article) Update ¶
@Summary 更新文章 @Produce json @Param tag_id body string false "标签ID" @Param title body string false "文章标题" @Param desc body string false "文章简述" @Param cover_image_url body string false "封面图片地址" @Param content body string false "文章内容" @Param modified_by body string true "修改者" @Success 200 {object} app.MapResponse "成功" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /api/v1/articles/{id} [put].
type Tag ¶
type Tag struct {
// contains filtered or unexported fields
}
func (*Tag) Create ¶
@Summary 新增标签 @Produce json @Param name body string true "标签名称" minlength(3) maxlength(100) @Param state body int false "状态" Enums(0, 1) default(1) @Param created_by body string false "创建者" minlength(3) maxlength(100) @Success 200 {object} app.MapResponse "成功" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /api/v1/tags [post].
func (*Tag) Delete ¶
@Summary 删除标签 @Produce json @Param id path int true "标签ID" @Success 200 {string} string "成功" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /api/v1/tags/{id} [delete].
func (*Tag) List ¶
@Summary 获取多个标签 @Produce json @Param name query string false "标签名称" maxlength(100) @Param state query int false "状态" Enums(0, 1) default(1) @Param page query int false "页码" @Param page_size query int false "每页数量" @Success 200 {object} app.ListResponse "成功" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /api/v1/tags [get].
func (*Tag) Update ¶
@Summary 更新标签 @Produce json @Param id path int true "标签ID" @Param name body string false "标签名称" minlength(3) maxlength(100) @Param state body int false "状态" Enums(0, 1) default(1) @Param modified_by body string true "修改者" minlength(3) maxlength(100) @Success 200 {array} app.MapResponse "成功" @Failure 400 {object} errcode.Error "请求错误" @Failure 500 {object} errcode.Error "内部错误" @Router /api/v1/tags/{id} [put].