Add event join service and api endpoint
All checks were successful
Backend Check Build (NixCN CMS) TeamCity build finished
Client CMS Check Build (NixCN CMS) TeamCity build finished

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-31 11:58:56 +08:00
parent 82c476fa80
commit 1504954be4
6 changed files with 485 additions and 1 deletions

View File

@@ -909,6 +909,111 @@ const docTemplate = `{
}
}
},
"/event/join": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Allows an authenticated user to join an event by providing the event ID. The user's role and state are initialized by the service.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Event"
],
"summary": "Join an Event",
"parameters": [
{
"description": "Event Join Details (UserId and EventId are required)",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/service_event.EventJoinData"
}
}
],
"responses": {
"200": {
"description": "Successfully joined the event",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"400": {
"description": "Invalid Input or UUID Parse Failed",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"403": {
"description": "Unauthorized / Missing User ID",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error / Database Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
}
},
"/event/list": {
"get": {
"security": [
@@ -1611,6 +1716,23 @@ const docTemplate = `{
}
}
},
"service_event.EventJoinData": {
"type": "object",
"properties": {
"event_id": {
"type": "string"
},
"role": {
"type": "string"
},
"state": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"service_user.UserInfoData": {
"type": "object",
"properties": {

View File

@@ -907,6 +907,111 @@
}
}
},
"/event/join": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Allows an authenticated user to join an event by providing the event ID. The user's role and state are initialized by the service.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Event"
],
"summary": "Join an Event",
"parameters": [
{
"description": "Event Join Details (UserId and EventId are required)",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/service_event.EventJoinData"
}
}
],
"responses": {
"200": {
"description": "Successfully joined the event",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"400": {
"description": "Invalid Input or UUID Parse Failed",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"403": {
"description": "Unauthorized / Missing User ID",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
},
"500": {
"description": "Internal Server Error / Database Error",
"schema": {
"allOf": [
{
"$ref": "#/definitions/utils.RespStatus"
},
{
"type": "object",
"properties": {
"data": {
"type": "object"
}
}
}
]
}
}
}
}
},
"/event/list": {
"get": {
"security": [
@@ -1609,6 +1714,23 @@
}
}
},
"service_event.EventJoinData": {
"type": "object",
"properties": {
"event_id": {
"type": "string"
},
"role": {
"type": "string"
},
"state": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"service_user.UserInfoData": {
"type": "object",
"properties": {

View File

@@ -100,6 +100,17 @@ definitions:
checkin_code:
type: string
type: object
service_event.EventJoinData:
properties:
event_id:
type: string
role:
type: string
state:
type: string
user_id:
type: string
type: object
service_user.UserInfoData:
properties:
allow_public:
@@ -636,6 +647,63 @@ paths:
summary: Get Event Information
tags:
- Event
/event/join:
post:
consumes:
- application/json
description: Allows an authenticated user to join an event by providing the
event ID. The user's role and state are initialized by the service.
parameters:
- description: Event Join Details (UserId and EventId are required)
in: body
name: request
required: true
schema:
$ref: '#/definitions/service_event.EventJoinData'
produces:
- application/json
responses:
"200":
description: Successfully joined the event
schema:
allOf:
- $ref: '#/definitions/utils.RespStatus'
- properties:
data:
type: object
type: object
"400":
description: Invalid Input or UUID Parse Failed
schema:
allOf:
- $ref: '#/definitions/utils.RespStatus'
- properties:
data:
type: object
type: object
"403":
description: Unauthorized / Missing User ID
schema:
allOf:
- $ref: '#/definitions/utils.RespStatus'
- properties:
data:
type: object
type: object
"500":
description: Internal Server Error / Database Error
schema:
allOf:
- $ref: '#/definitions/utils.RespStatus'
- properties:
data:
type: object
type: object
security:
- ApiKeyAuth: []
summary: Join an Event
tags:
- Event
/event/list:
get:
consumes: