feat: add backend_v1 migration
Some checks failed
build quyun / Build (push) Has been cancelled

This commit is contained in:
2025-12-19 14:46:58 +08:00
parent 218eb4689c
commit 24bd161df9
119 changed files with 12259 additions and 0 deletions

141
backend_v1/docs/docs.go Normal file
View File

@@ -0,0 +1,141 @@
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/rogeecn/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "UserName",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/v1/medias/{id}": {
"post": {
"description": "Test",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Test"
],
"summary": "Test",
"parameters": [
{
"type": "integer",
"description": "ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "年龄",
"name": "age",
"in": "query"
},
{
"type": "string",
"description": "名称",
"name": "name",
"in": "query"
},
{
"type": "integer",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"name": "page",
"in": "query"
}
],
"responses": {
"200": {
"description": "成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/requests.Pager"
},
{
"type": "object",
"properties": {
"list": {
"$ref": "#/definitions/v1.ResponseItem"
}
}
}
]
}
}
}
}
}
},
"definitions": {
"requests.Pager": {
"type": "object",
"properties": {
"items": {},
"limit": {
"type": "integer"
},
"page": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
},
"v1.ResponseItem": {
"type": "object"
}
},
"securityDefinitions": {
"BasicAuth": {
"type": "basic"
}
},
"externalDocs": {
"description": "OpenAPI",
"url": "https://swagger.io/resources/open-api/"
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "localhost:8080",
BasePath: "/api/v1",
Schemes: []string{},
Title: "ApiDoc",
Description: "This is a sample server celler server.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}

10
backend_v1/docs/ember.go Normal file
View File

@@ -0,0 +1,10 @@
package docs
import (
_ "embed"
_ "github.com/rogeecn/swag"
)
//go:embed swagger.json
var SwaggerSpec string

View File

@@ -0,0 +1,117 @@
{
"swagger": "2.0",
"info": {
"description": "This is a sample server celler server.",
"title": "ApiDoc",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "UserName",
"url": "http://www.swagger.io/support",
"email": "support@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
},
"host": "localhost:8080",
"basePath": "/api/v1",
"paths": {
"/v1/medias/{id}": {
"post": {
"description": "Test",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Test"
],
"summary": "Test",
"parameters": [
{
"type": "integer",
"description": "ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "年龄",
"name": "age",
"in": "query"
},
{
"type": "string",
"description": "名称",
"name": "name",
"in": "query"
},
{
"type": "integer",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"name": "page",
"in": "query"
}
],
"responses": {
"200": {
"description": "成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/requests.Pager"
},
{
"type": "object",
"properties": {
"list": {
"$ref": "#/definitions/v1.ResponseItem"
}
}
}
]
}
}
}
}
}
},
"definitions": {
"requests.Pager": {
"type": "object",
"properties": {
"items": {},
"limit": {
"type": "integer"
},
"page": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
},
"v1.ResponseItem": {
"type": "object"
}
},
"securityDefinitions": {
"BasicAuth": {
"type": "basic"
}
},
"externalDocs": {
"description": "OpenAPI",
"url": "https://swagger.io/resources/open-api/"
}
}

View File

@@ -0,0 +1,75 @@
basePath: /api/v1
definitions:
requests.Pager:
properties:
items: {}
limit:
type: integer
page:
type: integer
total:
type: integer
type: object
v1.ResponseItem:
type: object
externalDocs:
description: OpenAPI
url: https://swagger.io/resources/open-api/
host: localhost:8080
info:
contact:
email: support@swagger.io
name: UserName
url: http://www.swagger.io/support
description: This is a sample server celler server.
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: ApiDoc
version: "1.0"
paths:
/v1/medias/{id}:
post:
consumes:
- application/json
description: Test
parameters:
- description: ID
in: path
name: id
required: true
type: integer
- description: 年龄
in: query
name: age
type: integer
- description: 名称
in: query
name: name
type: string
- in: query
name: limit
type: integer
- in: query
name: page
type: integer
produces:
- application/json
responses:
"200":
description: 成功
schema:
allOf:
- $ref: '#/definitions/requests.Pager'
- properties:
list:
$ref: '#/definitions/v1.ResponseItem'
type: object
summary: Test
tags:
- Test
securityDefinitions:
BasicAuth:
type: basic
swagger: "2.0"