Files
rill/docs/docs.go
T
kevin 926ad91943 新增站点信息表与后台管理页面
- 新增 site_settings 单行表(迁移 v7),保存网站名称、Logo 图片地址与页脚版权文案
- 新增 GET /api/site(公开)与 PUT /api/site(仅管理员),空值回退前端默认展示
- 前端头部、登录注册页、浏览器标题与页脚接入站点信息,Pinia store 启动时加载
- 新增 /admin/site 后台管理页面,头像下拉仅管理员显示“后台管理”,路由加 requiresAdmin 守卫
- 补充站点接口、迁移与权限测试,重新生成 Swagger 文档
2026-09-21 16:17:28 +08:00

1803 lines
62 KiB
Go

// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/auth/login": {
"post": {
"description": "Login with username or email; returns a JWT (TTL from auth.token_ttl) and the user.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Login",
"parameters": [
{
"description": "Login credentials",
"name": "credentials",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.LoginRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/auth.LoginResponse"
}
},
"400": {
"description": "invalid request",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "incorrect account or password",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
}
},
"/auth/register": {
"post": {
"description": "Public registration. Creates a regular user in the default user group (id 1). username is 3-50 chars and unique; email is unique; password is 6-72 chars.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Register",
"parameters": [
{
"description": "Registration payload",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.RegisterRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"400": {
"description": "invalid request",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"409": {
"description": "username or email already exists",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
}
},
"/health": {
"get": {
"description": "Check service and database connectivity; returns 503 when the database is unavailable.",
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "Health check",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.HealthResponse"
}
},
"503": {
"description": "Service Unavailable",
"schema": {
"$ref": "#/definitions/api.HealthResponse"
}
}
}
}
},
"/me": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Return the authenticated user's profile, including groups.",
"produces": [
"application/json"
],
"tags": [
"profile"
],
"summary": "Get current user profile",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update the authenticated user's nickname, gender, and birthday. birthday accepts YYYY-MM-DD, an empty string clears it, and omitting it keeps the current value.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"profile"
],
"summary": "Update current user profile",
"parameters": [
{
"description": "Fields to update",
"name": "profile",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.UpdateProfileRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"400": {
"description": "invalid request",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
}
},
"/notes": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "List notes ordered by id DESC. page starts at 1; page_size is 1-100, default 20.",
"produces": [
"application/json"
],
"tags": [
"notes"
],
"summary": "List notes",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Page number, default 1",
"name": "page",
"in": "query"
},
{
"type": "integer",
"example": 20,
"description": "Page size, default 20, max 100",
"name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/note.ListResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Create a note. title is required (max 200 chars); content is optional.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"notes"
],
"summary": "Create a note",
"parameters": [
{
"description": "Note payload",
"name": "note",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/note.Request"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/model.Note"
}
},
"400": {
"description": "invalid request",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
}
},
"/notes/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get a note by id.",
"produces": [
"application/json"
],
"tags": [
"notes"
],
"summary": "Get a note",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Note ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Note"
}
},
"400": {
"description": "invalid id",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"404": {
"description": "record not found",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update title and content; validation is the same as create.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"notes"
],
"summary": "Update a note",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Note ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Note payload",
"name": "note",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/note.Request"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Note"
}
},
"400": {
"description": "invalid request or id",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"404": {
"description": "record not found",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete a note by id; returns 204 with no body on success.",
"produces": [
"application/json"
],
"tags": [
"notes"
],
"summary": "Delete a note",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Note ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "Deleted"
},
"400": {
"description": "invalid id",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"404": {
"description": "record not found",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
}
},
"/site": {
"get": {
"description": "Public site settings: site name, logo URL, and footer text. Returns built-in defaults when the settings row is missing.",
"produces": [
"application/json"
],
"tags": [
"site"
],
"summary": "Get site settings",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.SiteSetting"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Admin only. Update the site name, logo URL, and footer text; returns the updated settings.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"site"
],
"summary": "Update site settings",
"parameters": [
{
"description": "Site settings",
"name": "site",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/site.UpdateRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.SiteSetting"
}
},
"400": {
"description": "invalid request",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "admin permission required or account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
}
},
"/user-groups": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "List user groups ordered by id ASC. page starts at 1; page_size is 1-100, default 20.",
"produces": [
"application/json"
],
"tags": [
"user-groups"
],
"summary": "List user groups",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Page number, default 1",
"name": "page",
"in": "query"
},
{
"type": "integer",
"example": 20,
"description": "Page size, default 20, max 100",
"name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/usergroup.ListResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "admin permission required or account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Create a user group. name is required and unique (max 50 chars); description is optional (max 255 chars); id is assigned by the server.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user-groups"
],
"summary": "Create a user group",
"parameters": [
{
"description": "User group payload",
"name": "group",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/usergroup.Request"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/model.UserGroup"
}
},
"400": {
"description": "invalid request",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "admin permission required or account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"409": {
"description": "user group name already exists",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
}
},
"/user-groups/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get a user group by id; id 0 is the built-in admin group.",
"produces": [
"application/json"
],
"tags": [
"user-groups"
],
"summary": "Get a user group",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "User group ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.UserGroup"
}
},
"400": {
"description": "invalid id",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "admin permission required or account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"404": {
"description": "record not found",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update a user group's name and description; name is required and unique.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user-groups"
],
"summary": "Update a user group",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "User group ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "User group payload",
"name": "group",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/usergroup.Request"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.UserGroup"
}
},
"400": {
"description": "invalid request or id",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "admin permission required or account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"404": {
"description": "record not found",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"409": {
"description": "user group name already exists",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete a user group by id; returns 204 with no body on success. Returns 409 for system groups or when the group still has members.",
"produces": [
"application/json"
],
"tags": [
"user-groups"
],
"summary": "Delete a user group",
"parameters": [
{
"type": "integer",
"example": 2,
"description": "User group ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "Deleted"
},
"400": {
"description": "invalid id",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "admin permission required or account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"404": {
"description": "record not found",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"409": {
"description": "system group cannot be deleted or group still has members",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
}
},
"/users": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "List users with their groups, ordered by id DESC. page starts at 1; page_size is 1-100, default 20.",
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "List users",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "Page number, default 1",
"name": "page",
"in": "query"
},
{
"type": "integer",
"example": 20,
"description": "Page size, default 20, max 100",
"name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/user.ListResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "admin permission required or account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Create a user and assign groups. username and email are unique; password is 6-72 chars; gender is male/female/other; birthday is YYYY-MM-DD and cannot be in the future; defaults to the regular user group (id 1) when group_ids is omitted.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Create a user",
"parameters": [
{
"description": "User payload",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.CreateRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"400": {
"description": "invalid request or user group not found",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "admin permission required or account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"409": {
"description": "username or email already exists",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
}
},
"/users/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get a user by id, including groups.",
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Get a user",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"400": {
"description": "invalid id",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "admin permission required or account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"404": {
"description": "record not found",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update user fields. group_ids replaces all groups; a non-empty password resets the password; birthday accepts YYYY-MM-DD, an empty string clears it, and omitting it keeps the current value.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Update a user",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Fields to update",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/user.UpdateRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"400": {
"description": "invalid request, id, or user group not found",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "admin permission required or account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"404": {
"description": "record not found",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete a user and their group memberships; returns 204 with no body on success.",
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Delete a user",
"parameters": [
{
"type": "integer",
"example": 1,
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "Deleted"
},
"400": {
"description": "invalid id",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"401": {
"description": "unauthorized or session expired",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"403": {
"description": "admin permission required or account disabled",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"404": {
"description": "record not found",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpx.ErrorResponse"
}
}
}
}
}
},
"definitions": {
"api.HealthResponse": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "database unavailable"
},
"status": {
"type": "string",
"example": "ok"
}
}
},
"auth.LoginRequest": {
"type": "object",
"required": [
"account",
"password"
],
"properties": {
"account": {
"type": "string",
"example": "alice"
},
"password": {
"type": "string",
"example": "secret123"
}
}
},
"auth.LoginResponse": {
"type": "object",
"properties": {
"expires_at": {
"type": "string",
"example": "2026-09-21T10:00:00+08:00"
},
"token": {
"type": "string",
"example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
},
"user": {
"$ref": "#/definitions/model.User"
}
}
},
"auth.RegisterRequest": {
"type": "object",
"required": [
"email",
"password",
"username"
],
"properties": {
"email": {
"type": "string",
"maxLength": 255,
"example": "alice@example.com"
},
"password": {
"type": "string",
"maxLength": 72,
"minLength": 6,
"example": "secret123"
},
"username": {
"type": "string",
"maxLength": 50,
"minLength": 3,
"example": "alice"
}
}
},
"auth.UpdateProfileRequest": {
"type": "object",
"properties": {
"birthday": {
"type": "string",
"example": "1995-06-15"
},
"gender": {
"type": "string",
"example": "male"
},
"nickname": {
"type": "string",
"maxLength": 50,
"example": "Alice"
}
}
},
"httpx.ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "record not found"
}
}
},
"model.Note": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"title": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"model.SiteSetting": {
"type": "object",
"properties": {
"footer": {
"type": "string",
"example": "Copyright © Rill"
},
"logo": {
"type": "string",
"example": "https://example.com/logo.png"
},
"site_name": {
"type": "string",
"example": "Rill"
},
"updated_at": {
"type": "string"
}
}
},
"model.User": {
"type": "object",
"properties": {
"avatar": {
"type": "string"
},
"birthday": {
"type": "string",
"example": "1995-06-15"
},
"created_at": {
"type": "string"
},
"email": {
"type": "string"
},
"gender": {
"type": "string",
"example": "male"
},
"groups": {
"type": "array",
"items": {
"$ref": "#/definitions/model.UserGroup"
}
},
"id": {
"type": "integer"
},
"nickname": {
"type": "string"
},
"status": {
"type": "integer"
},
"updated_at": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"model.UserGroup": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"is_system": {
"type": "boolean"
},
"name": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"note.ListResponse": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Note"
}
},
"page": {
"type": "integer",
"example": 1
},
"page_size": {
"type": "integer",
"example": 20
},
"total": {
"type": "integer",
"example": 42
}
}
},
"note.Request": {
"type": "object",
"required": [
"title"
],
"properties": {
"content": {
"type": "string",
"example": "Milk, eggs"
},
"title": {
"type": "string",
"maxLength": 200,
"example": "Shopping list"
}
}
},
"site.UpdateRequest": {
"type": "object",
"required": [
"site_name"
],
"properties": {
"footer": {
"type": "string",
"maxLength": 1000,
"example": "Copyright © Rill"
},
"logo": {
"type": "string",
"maxLength": 500,
"example": "https://example.com/logo.png"
},
"site_name": {
"type": "string",
"maxLength": 100,
"example": "Rill"
}
}
},
"user.CreateRequest": {
"type": "object",
"required": [
"email",
"password",
"username"
],
"properties": {
"avatar": {
"type": "string",
"maxLength": 255,
"example": "https://example.com/avatar.png"
},
"birthday": {
"type": "string",
"example": "1995-06-15"
},
"email": {
"type": "string",
"maxLength": 255,
"example": "alice@example.com"
},
"gender": {
"type": "string",
"enum": [
"male",
"female",
"other"
],
"example": "male"
},
"group_ids": {
"type": "array",
"items": {
"type": "integer"
},
"example": [
1
]
},
"nickname": {
"type": "string",
"maxLength": 50,
"example": "Alice"
},
"password": {
"type": "string",
"maxLength": 72,
"minLength": 6,
"example": "secret123"
},
"status": {
"type": "integer",
"enum": [
0,
1
],
"example": 1
},
"username": {
"type": "string",
"maxLength": 50,
"example": "alice"
}
}
},
"user.ListResponse": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/model.User"
}
},
"page": {
"type": "integer",
"example": 1
},
"page_size": {
"type": "integer",
"example": 20
},
"total": {
"type": "integer",
"example": 42
}
}
},
"user.UpdateRequest": {
"type": "object",
"properties": {
"avatar": {
"type": "string",
"maxLength": 255,
"example": "https://example.com/avatar.png"
},
"birthday": {
"type": "string",
"example": "1995-06-15"
},
"gender": {
"type": "string",
"enum": [
"male",
"female",
"other"
],
"example": "male"
},
"group_ids": {
"type": "array",
"items": {
"type": "integer"
},
"example": [
1
]
},
"nickname": {
"type": "string",
"maxLength": 50,
"example": "Alice"
},
"password": {
"type": "string",
"maxLength": 72,
"minLength": 6,
"example": "secret123"
},
"status": {
"type": "integer",
"enum": [
0,
1
],
"example": 1
}
}
},
"usergroup.ListResponse": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/model.UserGroup"
}
},
"page": {
"type": "integer",
"example": 1
},
"page_size": {
"type": "integer",
"example": 20
},
"total": {
"type": "integer",
"example": 42
}
}
},
"usergroup.Request": {
"type": "object",
"required": [
"name"
],
"properties": {
"description": {
"type": "string",
"maxLength": 255,
"example": "Handles daily operations"
},
"name": {
"type": "string",
"maxLength": 50,
"example": "Operations"
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"description": "Bearer JWT, format: Bearer {token}, obtained from /auth/login",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "",
BasePath: "/api",
Schemes: []string{},
Title: "Rill API",
Description: "Rill server HTTP API documentation. All endpoints are prefixed with api.prefix (default /api); requests and responses are JSON.\nSwagger UI: {prefix}/swagger/index.html; OpenAPI JSON: {prefix}/swagger/doc.json.\nExcept for health, swagger, and auth, all endpoints require a Bearer JWT: call /auth/login to get a token, then send Authorization: Bearer {token}.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}