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:
22
internal/dto/namespace.go
Normal file
22
internal/dto/namespace.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package dto
|
||||
|
||||
import "time"
|
||||
|
||||
// NamespaceResponse represents a namespace in API responses.
|
||||
// @Description Namespace response
|
||||
type NamespaceResponse struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Name string `json:"name" example:"default"`
|
||||
Status string `json:"status" example:"active"`
|
||||
Description string `json:"description,omitempty" example:"Default namespace"`
|
||||
}
|
||||
|
||||
// NamespaceDTO defines inbound payload for namespace creation/update.
|
||||
// @Description Namespace create/update request
|
||||
type NamespaceDTO struct {
|
||||
Name string `json:"name" example:"default"`
|
||||
Status string `json:"status" example:"active"`
|
||||
Description string `json:"description,omitempty" example:"Default namespace"`
|
||||
}
|
||||
Reference in New Issue
Block a user