mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(api): add admin master key listing/revoke
Add admin endpoints to list and revoke child keys under a master. Standardize OpenAPI responses to use ResponseEnvelope with MapData for error payloads, and regenerate swagger specs accordingly.
This commit is contained in:
@@ -63,8 +63,8 @@ func (h *Handler) logBaseQuery() *gorm.DB {
|
||||
// @Security AdminAuth
|
||||
// @Param model body dto.ModelDTO true "Model Info"
|
||||
// @Success 201 {object} ResponseEnvelope{data=model.Model}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/models [post]
|
||||
func (h *Handler) CreateModel(c *gin.Context) {
|
||||
var req dto.ModelDTO
|
||||
@@ -124,7 +124,7 @@ func (h *Handler) CreateModel(c *gin.Context) {
|
||||
// @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}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/models [get]
|
||||
func (h *Handler) ListModels(c *gin.Context) {
|
||||
var models []model.Model
|
||||
@@ -149,9 +149,9 @@ func (h *Handler) ListModels(c *gin.Context) {
|
||||
// @Param id path int true "Model ID"
|
||||
// @Param model body dto.ModelDTO true "Model Info"
|
||||
// @Success 200 {object} ResponseEnvelope{data=model.Model}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 404 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 404 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/models/{id} [put]
|
||||
func (h *Handler) UpdateModel(c *gin.Context) {
|
||||
idParam := c.Param("id")
|
||||
@@ -222,10 +222,10 @@ func (h *Handler) UpdateModel(c *gin.Context) {
|
||||
// @Produce json
|
||||
// @Security AdminAuth
|
||||
// @Param id path int true "Model ID"
|
||||
// @Success 200 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 404 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Success 200 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 404 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/models/{id} [delete]
|
||||
func (h *Handler) DeleteModel(c *gin.Context) {
|
||||
idParam := c.Param("id")
|
||||
@@ -260,8 +260,8 @@ func (h *Handler) DeleteModel(c *gin.Context) {
|
||||
// @Tags admin
|
||||
// @Produce json
|
||||
// @Security AdminAuth
|
||||
// @Success 200 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Success 200 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 500 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /admin/sync/snapshot [post]
|
||||
func (h *Handler) SyncSnapshot(c *gin.Context) {
|
||||
if err := h.sync.SyncAll(h.db); err != nil {
|
||||
@@ -278,8 +278,8 @@ func (h *Handler) SyncSnapshot(c *gin.Context) {
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param log body model.LogRecord true "Log Record"
|
||||
// @Success 202 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=gin.H}
|
||||
// @Success 202 {object} ResponseEnvelope{data=MapData}
|
||||
// @Failure 400 {object} ResponseEnvelope{data=MapData}
|
||||
// @Router /logs [post]
|
||||
func (h *Handler) IngestLog(c *gin.Context) {
|
||||
var rec model.LogRecord
|
||||
|
||||
Reference in New Issue
Block a user