Fix: Using bigint and added backend testing

This commit is contained in:
Aron Malcher 2024-03-10 17:12:50 +01:00
parent ed6195e1e2
commit 89507f8412
Signed by: aronmal
GPG key ID: 816B7707426FC612
20 changed files with 830 additions and 292 deletions

View file

@ -31,13 +31,34 @@
}
},
"400": {
"description": "Invalid ID supplied"
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"401": {
"description": "Unauthorized"
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"404": {
"description": "Guild not found"
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
}
},
"security": [
@ -77,13 +98,92 @@
}
},
"400": {
"description": "Invalid ID supplied"
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"401": {
"description": "Unauthorized"
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"404": {
"description": "Guild not found"
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
}
},
"security": [
{
"basicAuth": []
}
]
},
"post": {
"tags": ["Guild config"],
"summary": "Creates a guild's config by ID",
"description": "Create a guild's config when the bot is has joined a new guild.",
"operationId": "postGuildById",
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild's config to create",
"required": true,
"schema": {
"type": "string",
"format": "varchar(20)"
}
}
],
"responses": {
"204": {
"description": "successful operation"
},
"400": {
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"404": {
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
}
},
"security": [
@ -101,7 +201,7 @@
{
"name": "guildId",
"in": "path",
"description": "ID of guild config to delete",
"description": "ID of guild's config to delete",
"required": true,
"schema": {
"type": "string",
@ -114,13 +214,34 @@
"description": "successful operation"
},
"400": {
"description": "Invalid ID supplied"
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"401": {
"description": "Unauthorized"
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"404": {
"description": "Guild not found"
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
}
},
"security": [
@ -130,17 +251,17 @@
]
}
},
"/api/{guildId}/tp_messages": {
"/api/{guildId}/timePlanning": {
"get": {
"tags": ["Time planning messages"],
"summary": "Find the tp_messages of guild by ID",
"description": "Returns tp_messages for a guild",
"operationId": "getTp_messagesOfGuildById",
"summary": "Find the timePlanning of guild by ID",
"description": "Returns timePlanning for a guild",
"operationId": "gettimePlanningOfGuildById",
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild's tp_messages to return",
"description": "ID of guild's timePlanning to return",
"required": true,
"schema": {
"type": "string",
@ -154,22 +275,40 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tp_messages"
"$ref": "#/components/schemas/timePlanning"
}
}
}
},
"204": {
"description": "Time planning not enabled for this guild"
},
"400": {
"description": "Invalid ID supplied"
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"401": {
"description": "Unauthorized"
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"404": {
"description": "Guild not found"
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
}
},
"security": [
@ -180,14 +319,14 @@
},
"put": {
"tags": ["Time planning messages"],
"summary": "Put new message IDs for tp_messages of guild by ID",
"description": "Returns tp_messages for a guild",
"operationId": "putTp_messagesOfGuildById",
"summary": "Put new message IDs for timePlanning of guild by ID",
"description": "Returns timePlanning for a guild",
"operationId": "puttimePlanningOfGuildById",
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild's tp_messages to return",
"description": "ID of guild's timePlanning to return",
"required": true,
"schema": {
"type": "string",
@ -196,11 +335,11 @@
}
],
"requestBody": {
"description": "Put new message IDs for tp_messages in channel",
"description": "Put new message IDs for timePlanning in channel",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tp_messages"
"$ref": "#/components/schemas/timePlanning"
}
}
},
@ -211,16 +350,34 @@
"description": "successful operation"
},
"400": {
"description": "Invalid ID supplied"
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Time planning not enabled for this guild"
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"404": {
"description": "Guild not found"
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
}
},
"security": [
@ -234,13 +391,13 @@
"get": {
"tags": ["Matches"],
"summary": "Find all matches of guild by ID",
"description": "Returns tp_messages for a guild",
"description": "Returns timePlanning for a guild",
"operationId": "getMatchesOfGuildById",
"parameters": [
{
"name": "guildId",
"in": "path",
"description": "ID of guild's tp_messages to return",
"description": "ID of guild's timePlanning to return",
"required": true,
"schema": {
"type": "string",
@ -273,17 +430,35 @@
}
}
},
"204": {
"description": "Time planning not enabled for this guild"
},
"400": {
"description": "Invalid ID supplied"
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"401": {
"description": "Unauthorized"
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"404": {
"description": "Guild not found"
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
}
},
"security": [
@ -295,7 +470,7 @@
"post": {
"tags": ["Matches"],
"summary": "Save a new created match of guild by ID",
"description": "Returns tp_messages for a guild",
"description": "Returns timePlanning for a guild",
"operationId": "postMatchOfGuildById",
"parameters": [
{
@ -337,13 +512,34 @@
"description": "successful operation"
},
"400": {
"description": "Invalid ID supplied"
"description": "Invalid ID supplied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"401": {
"description": "Unauthorized"
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
},
"404": {
"description": "Guild not found"
"description": "Guild not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error"
}
}
}
}
},
"security": [
@ -361,8 +557,7 @@
"required": ["guildId", "timezone", "features", "matches", "checksum"],
"properties": {
"guildId": {
"type": "number",
"example": 1234567890123456789
"$ref": "#/components/schemas/id"
},
"timezone": {
"type": "string",
@ -388,9 +583,7 @@
"type": "boolean"
},
"channelId": {
"type": "number",
"example": 1234567890123456789,
"nullable": true
"$ref": "#/components/schemas/idOrNull"
},
"targetMinute": {
"type": "number",
@ -416,14 +609,10 @@
"type": "boolean"
},
"isAvailableRoleId": {
"type": "number",
"example": 1234567890123456789,
"nullable": true
"$ref": "#/components/schemas/idOrNull"
},
"wantsToBeNotifieRoledId": {
"type": "number",
"example": 1234567890123456789,
"nullable": true
"$ref": "#/components/schemas/idOrNull"
}
}
}
@ -455,20 +644,16 @@
],
"properties": {
"channelId": {
"type": "number",
"example": 1234567890123456789
"$ref": "#/components/schemas/id"
},
"createrId": {
"type": "number",
"example": 1234567890123456789
"$ref": "#/components/schemas/id"
},
"roleId": {
"type": "number",
"example": 1234567890123456789
"$ref": "#/components/schemas/id"
},
"messageId": {
"type": "number",
"example": 1234567890123456789
"$ref": "#/components/schemas/id"
},
"matchType": {
"type": "string",
@ -486,56 +671,80 @@
}
}
},
"tp_messages": {
"timePlanning": {
"type": "object",
"required": ["channelId", "messageIds"],
"required": [
"enabled",
"channelId",
"rolesEnabled",
"isAvailableRoleId",
"wantsToBeNotifieRoledId",
"messageIds"
],
"properties": {
"enabled": {
"type": "boolean"
},
"channelId": {
"type": "number",
"example": 1234567890123456789
"$ref": "#/components/schemas/idOrNull"
},
"rolesEnabled": {
"type": "boolean"
},
"isAvailableRoleId": {
"$ref": "#/components/schemas/idOrNull"
},
"wantsToBeNotifieRoledId": {
"$ref": "#/components/schemas/idOrNull"
},
"messageIds": {
"type": "object",
"required": ["0", "1", "2", "3", "4", "5", "6"],
"properties": {
"0": {
"type": "number",
"example": 1234567890123456789,
"nullable": true
"$ref": "#/components/schemas/idOrNull"
},
"1": {
"type": "number",
"example": 1234567890123456789,
"nullable": true
"$ref": "#/components/schemas/idOrNull"
},
"2": {
"type": "number",
"example": 1234567890123456789,
"nullable": true
"$ref": "#/components/schemas/idOrNull"
},
"3": {
"type": "number",
"example": 1234567890123456789,
"nullable": true
"$ref": "#/components/schemas/idOrNull"
},
"4": {
"type": "number",
"example": 1234567890123456789,
"nullable": true
"$ref": "#/components/schemas/idOrNull"
},
"5": {
"type": "number",
"example": 1234567890123456789,
"nullable": true
"$ref": "#/components/schemas/idOrNull"
},
"6": {
"type": "number",
"example": 1234567890123456789,
"nullable": true
"$ref": "#/components/schemas/idOrNull"
}
}
}
}
},
"id": {
"type": "string",
"pattern": "^\\d{7,20}$",
"example": "1234567890123456789"
},
"idOrNull": {
"type": "string",
"pattern": "^\\d{7,20}$",
"example": "1234567890123456789",
"nullable": true
},
"error": {
"type": "object",
"required": "error",
"properties": {
"error": {
"type": "string"
}
}
}
},
"securitySchemes": {