first commit

This commit is contained in:
2025-10-31 17:54:29 +07:00
commit db01b8564d
1066 changed files with 424853 additions and 0 deletions
+377
View File
@@ -0,0 +1,377 @@
// 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": {
"/subscriptions": {
"get": {
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Список подписок",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Subscription"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Создать подписку",
"parameters": [
{
"description": "Создание подписки",
"name": "subscription",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.CreateSubscriptionRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/model.Subscription"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/subscriptions/sum": {
"get": {
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Суммарная стоимость подписок за период с фильтрацией",
"parameters": [
{
"type": "string",
"description": "UUID пользователя",
"name": "user_id",
"in": "query"
},
{
"type": "string",
"description": "Название сервиса",
"name": "service_name",
"in": "query"
},
{
"type": "string",
"example": "\"07-2025\"",
"description": "Начало периода, формат MM-YYYY",
"name": "start",
"in": "query",
"required": true
},
{
"type": "string",
"example": "\"08-2025\"",
"description": "Конец периода, формат MM-YYYY",
"name": "end",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/subscriptions/{id}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Получить подписку по ID",
"parameters": [
{
"type": "integer",
"description": "ID подписки",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Subscription"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Обновить подписку по ID",
"parameters": [
{
"type": "integer",
"description": "ID подписки",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Обновление подписки",
"name": "subscription",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.CreateSubscriptionRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Subscription"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"delete": {
"tags": [
"subscriptions"
],
"summary": "Удалить подписку по ID",
"parameters": [
{
"type": "integer",
"description": "ID подписки",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
},
"definitions": {
"handler.CreateSubscriptionRequest": {
"type": "object",
"properties": {
"end_date": {
"type": "string",
"example": "12-2025"
},
"price": {
"type": "integer",
"example": 400
},
"service_name": {
"type": "string",
"example": "Yandex Plus"
},
"start_date": {
"type": "string",
"example": "07-2025"
},
"user_id": {
"type": "string",
"example": "60601fee-2bf1-4721-ae6f-7636e79a0cba"
}
}
},
"model.Subscription": {
"type": "object",
"properties": {
"end_date": {
"type": "string"
},
"id": {
"type": "integer"
},
"price": {
"type": "integer"
},
"service_name": {
"type": "string"
},
"start_date": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "",
BasePath: "/",
Schemes: []string{},
Title: "Subscription API",
Description: "API для агрегации онлайн-подписок пользователей.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}
+3
View File
@@ -0,0 +1,3 @@
.topbar {
display: none;
}
+352
View File
@@ -0,0 +1,352 @@
{
"swagger": "2.0",
"info": {
"description": "API для агрегации онлайн-подписок пользователей.",
"title": "Subscription API",
"contact": {},
"version": "1.0"
},
"basePath": "/",
"paths": {
"/subscriptions": {
"get": {
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Список подписок",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Subscription"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Создать подписку",
"parameters": [
{
"description": "Создание подписки",
"name": "subscription",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.CreateSubscriptionRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/model.Subscription"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/subscriptions/sum": {
"get": {
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Суммарная стоимость подписок за период с фильтрацией",
"parameters": [
{
"type": "string",
"description": "UUID пользователя",
"name": "user_id",
"in": "query"
},
{
"type": "string",
"description": "Название сервиса",
"name": "service_name",
"in": "query"
},
{
"type": "string",
"example": "\"07-2025\"",
"description": "Начало периода, формат MM-YYYY",
"name": "start",
"in": "query",
"required": true
},
{
"type": "string",
"example": "\"08-2025\"",
"description": "Конец периода, формат MM-YYYY",
"name": "end",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "integer"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/subscriptions/{id}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Получить подписку по ID",
"parameters": [
{
"type": "integer",
"description": "ID подписки",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Subscription"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"put": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"subscriptions"
],
"summary": "Обновить подписку по ID",
"parameters": [
{
"type": "integer",
"description": "ID подписки",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Обновление подписки",
"name": "subscription",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.CreateSubscriptionRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/model.Subscription"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"delete": {
"tags": [
"subscriptions"
],
"summary": "Удалить подписку по ID",
"parameters": [
{
"type": "integer",
"description": "ID подписки",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
},
"definitions": {
"handler.CreateSubscriptionRequest": {
"type": "object",
"properties": {
"end_date": {
"type": "string",
"example": "12-2025"
},
"price": {
"type": "integer",
"example": 400
},
"service_name": {
"type": "string",
"example": "Yandex Plus"
},
"start_date": {
"type": "string",
"example": "07-2025"
},
"user_id": {
"type": "string",
"example": "60601fee-2bf1-4721-ae6f-7636e79a0cba"
}
}
},
"model.Subscription": {
"type": "object",
"properties": {
"end_date": {
"type": "string"
},
"id": {
"type": "integer"
},
"price": {
"type": "integer"
},
"service_name": {
"type": "string"
},
"start_date": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
}
}
}
+233
View File
@@ -0,0 +1,233 @@
basePath: /
definitions:
handler.CreateSubscriptionRequest:
properties:
end_date:
example: 12-2025
type: string
price:
example: 400
type: integer
service_name:
example: Yandex Plus
type: string
start_date:
example: 07-2025
type: string
user_id:
example: 60601fee-2bf1-4721-ae6f-7636e79a0cba
type: string
type: object
model.Subscription:
properties:
end_date:
type: string
id:
type: integer
price:
type: integer
service_name:
type: string
start_date:
type: string
user_id:
type: string
type: object
info:
contact: {}
description: API для агрегации онлайн-подписок пользователей.
title: Subscription API
version: "1.0"
paths:
/subscriptions:
get:
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/model.Subscription'
type: array
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Список подписок
tags:
- subscriptions
post:
consumes:
- application/json
parameters:
- description: Создание подписки
in: body
name: subscription
required: true
schema:
$ref: '#/definitions/handler.CreateSubscriptionRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/model.Subscription'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Создать подписку
tags:
- subscriptions
/subscriptions/{id}:
delete:
parameters:
- description: ID подписки
in: path
name: id
required: true
type: integer
responses:
"204":
description: No Content
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Удалить подписку по ID
tags:
- subscriptions
get:
parameters:
- description: ID подписки
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/model.Subscription'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
summary: Получить подписку по ID
tags:
- subscriptions
put:
consumes:
- application/json
parameters:
- description: ID подписки
in: path
name: id
required: true
type: integer
- description: Обновление подписки
in: body
name: subscription
required: true
schema:
$ref: '#/definitions/handler.CreateSubscriptionRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/model.Subscription'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Обновить подписку по ID
tags:
- subscriptions
/subscriptions/sum:
get:
parameters:
- description: UUID пользователя
in: query
name: user_id
type: string
- description: Название сервиса
in: query
name: service_name
type: string
- description: Начало периода, формат MM-YYYY
example: '"07-2025"'
in: query
name: start
required: true
type: string
- description: Конец периода, формат MM-YYYY
example: '"08-2025"'
in: query
name: end
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: integer
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Суммарная стоимость подписок за период с фильтрацией
tags:
- subscriptions
swagger: "2.0"