mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
refactor(api): standardize DTOs and update swagger
Decouple API contract from internal models by introducing dedicated DTOs for requests and responses. - Add Response DTOs for all resources (API Keys, Bindings, Models, Namespaces, etc.) - Update Swagger annotations to use DTOs with field examples instead of internal models - Refactor handlers to bind and return DTO structures - Consolidate request/response definitions in the dto package
This commit is contained in:
@@ -62,7 +62,7 @@ func (h *Handler) logBaseQuery() *gorm.DB {
|
||||
// @Produce json
|
||||
// @Security AdminAuth
|
||||
// @Param model body dto.ModelDTO true "Model Info"
|
||||
// @Success 201 {object} ResponseEnvelope{data=model.Model}
|
||||
// @Success 201 {object} ResponseEnvelope{data=dto.ModelResponse}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/models [post]
|
||||
@@ -123,7 +123,7 @@ func (h *Handler) CreateModel(c *gin.Context) {
|
||||
// @Param page query int false "page (1-based)"
|
||||
// @Param limit query int false "limit (default 50, max 200)"
|
||||
// @Param search query string false "search by name/kind"
|
||||
// @Success 200 {object} ResponseEnvelope{data=[]model.Model}
|
||||
// @Success 200 {object} ResponseEnvelope{data=[]dto.ModelResponse}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/models [get]
|
||||
func (h *Handler) ListModels(c *gin.Context) {
|
||||
@@ -148,7 +148,7 @@ func (h *Handler) ListModels(c *gin.Context) {
|
||||
// @Security AdminAuth
|
||||
// @Param id path int true "Model ID"
|
||||
// @Param model body dto.ModelDTO true "Model Info"
|
||||
// @Success 200 {object} ResponseEnvelope{data=model.Model}
|
||||
// @Success 200 {object} ResponseEnvelope{data=dto.ModelResponse}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 404 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
@@ -277,7 +277,7 @@ func (h *Handler) SyncSnapshot(c *gin.Context) {
|
||||
// @Tags system
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param log body model.LogRecord true "Log Record"
|
||||
// @Param log body dto.LogRecordRequest true "Log Record"
|
||||
// @Success 202 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /logs [post]
|
||||
|
||||
Reference in New Issue
Block a user