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:
@@ -19,7 +19,7 @@ import (
|
||||
// @Produce json
|
||||
// @Security AdminAuth
|
||||
// @Param binding body dto.BindingDTO true "Binding Info"
|
||||
// @Success 201 {object} ResponseEnvelope{data=model.Binding}
|
||||
// @Success 201 {object} ResponseEnvelope{data=dto.BindingResponse}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/bindings [post]
|
||||
@@ -84,7 +84,7 @@ func (h *Handler) CreateBinding(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 namespace/public_model"
|
||||
// @Success 200 {object} ResponseEnvelope{data=[]model.Binding}
|
||||
// @Success 200 {object} ResponseEnvelope{data=[]dto.BindingResponse}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/bindings [get]
|
||||
func (h *Handler) ListBindings(c *gin.Context) {
|
||||
@@ -109,7 +109,7 @@ func (h *Handler) ListBindings(c *gin.Context) {
|
||||
// @Security AdminAuth
|
||||
// @Param id path int true "Binding ID"
|
||||
// @Param binding body dto.BindingDTO true "Binding Info"
|
||||
// @Success 200 {object} ResponseEnvelope{data=model.Binding}
|
||||
// @Success 200 {object} ResponseEnvelope{data=dto.BindingResponse}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 404 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
@@ -180,7 +180,7 @@ func (h *Handler) UpdateBinding(c *gin.Context) {
|
||||
// @Produce json
|
||||
// @Security AdminAuth
|
||||
// @Param id path int true "Binding ID"
|
||||
// @Success 200 {object} ResponseEnvelope{data=model.Binding}
|
||||
// @Success 200 {object} ResponseEnvelope{data=dto.BindingResponse}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 404 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
|
||||
Reference in New Issue
Block a user