Skip to content
Snippets Groups Projects
spec.json 56.4 KiB
Newer Older
heikkkk's avatar
heikkkk committed
        ],
        "summary": "Get user accounts",
        "description": "Get accounts associated with a user by providing their bank profile id",
        "operationId": "getAccounts",
        "parameters": [
          {
            "name": "bankProfileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "404": {
            "description": "Bank profile id does not exist",
heikkkk's avatar
heikkkk committed
            "content": {
              "*/*": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Account"
                  }
                }
              }
            }
          },
          "200": {
            "description": "No accounts associated with a bank user",
heikkkk's avatar
heikkkk committed
            "content": {
              "*/*": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Account"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/users/{userId}/profile": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Get a profile",
        "description": "Get the profile of a user",
        "operationId": "getProfile",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully got profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProfileDTO"
                }
              }
            }
          }
        }
      }
    },
    "/api/users/search/{searchTerm}/{filter}": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Search for users by name and filter",
        "description": "Returns a list of users whose names contain the specified search term and match the filter.",
        "operationId": "getUsersByNameAndFilter",
        "parameters": [
          {
            "name": "searchTerm",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved list of users",
            "content": {
              "*/*": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserDTO"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/users/search/random/{amount}/{filter}": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Get X amount of random users",
        "description": "Get X amount of random users that fit the filter",
        "operationId": "getRandomUsers",
        "parameters": [
          {
            "name": "amount",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "filter",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved list of users",
            "content": {
              "*/*": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserDTO"
                  }
                }
              }
            }
          }
        }
      }
    },
heikkkk's avatar
heikkkk committed
    "/api/users/me": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Get the authenticated user",
        "description": "Get all user information for the authenticated user",
        "operationId": "getUser",
        "responses": {
          "200": {
            "description": "Successfully got user",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserDTO"
                }
              }
            }
          }
        }
      }
    },
    "/api/users/get-feedback": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Send feedback",
        "description": "Send feedback from a user.",
        "operationId": "getFeedback",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "*/*": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FeedbackResponseDTO"
                  }
                }
              }
            }
          }
        }
      }
    },
heikkkk's avatar
heikkkk committed
    "/api/leaderboard": {
      "get": {
        "tags": [
          "Leaderboard"
        ],
        "operationId": "getLeaderboard",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryCount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaderboardDTO"
                }
              }
            }
          }
        }
      }
    },
    "/api/leaderboard/surrounding": {
      "get": {
        "tags": [
          "Leaderboard"
        ],
        "operationId": "getSurrounding",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "filter",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entryCount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaderboardDTO"
                }
              }
            }
          }
        }
      }
    },
    "/api/item/store": {
heikkkk's avatar
heikkkk committed
      "get": {
        "tags": [
          "Item"
heikkkk's avatar
heikkkk committed
        ],
        "summary": "Get available store items",
        "description": "Retrieves all items available in the store and a flag indicating whether the user has purchased each item.",
        "operationId": "getStore",
heikkkk's avatar
heikkkk committed
        "responses": {
            "description": "List of store items fetched successfully",
Henrik's avatar
Henrik committed
            "content": {
              "*/*": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ItemDTO"
                  }
heikkkk's avatar
heikkkk committed
      }
    },
    "/api/item/inventory": {
heikkkk's avatar
heikkkk committed
      "get": {
        "tags": [
          "Item"
heikkkk's avatar
heikkkk committed
        ],
        "summary": "Get user inventory items",
        "description": "Retrieves a list of all items currently in the inventory of the user.",
        "operationId": "getInventory",
heikkkk's avatar
heikkkk committed
        "responses": {
          "200": {
            "description": "List of inventory items fetched successfully",
heikkkk's avatar
heikkkk committed
            "content": {
              "*/*": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/InventoryDTO"
    "/api/images/{id}": {
heikkkk's avatar
heikkkk committed
      "get": {
        "tags": [
          "Image"
        ],
        "summary": "Retrieve an image",
        "description": "Retrieve an image from the server",
        "operationId": "getImage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
heikkkk's avatar
heikkkk committed
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved the image",
heikkkk's avatar
heikkkk committed
            "content": {
              "*/*": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "description": "Image not found",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ExceptionResponse"
        },
        "security": []
heikkkk's avatar
heikkkk committed
      }
    },
    "/api/friends": {
      "get": {
        "tags": [
          "Friend"
        ],
        "summary": "Get all friends",
        "description": "Returns a list of all friends.",
        "operationId": "getFriends",
        "responses": {
          "200": {
            "description": "Successfully retrieved list of friends",
            "content": {
              "*/*": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserDTO"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/friends/requests": {
      "get": {
        "tags": [
          "Friend"
        ],
        "summary": "Get friend requests",
        "description": "Returns a list of all users who have sent a friend request.",
        "operationId": "getFriendRequests",
        "responses": {
          "200": {
            "description": "Successfully retrieved friend requests",
            "content": {
              "*/*": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserDTO"
                  }
                }
              }
            }
          }
        }
      }
    },
heikkkk's avatar
heikkkk committed
    "/api/budget": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Get the list of budgets",
        "description": "Get all budgets related to the authenticated user",
        "operationId": "getBudgetsByUser",
        "responses": {
          "200": {
            "description": "Successfully got budgets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/BudgetResponseDTO"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/budget/{budgetId}": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Get the budget",
        "description": "Get budget by its id ",
        "operationId": "getBudget",
        "parameters": [
          {
            "name": "budgetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "500": {
            "description": "Budget is not found",
heikkkk's avatar
heikkkk committed
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BudgetResponseDTO"
                }
              }
            }
          },
          "200": {
            "description": "Successfully got budget",
heikkkk's avatar
heikkkk committed
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BudgetResponseDTO"
                }
              }
            }
          }
        }
      }
    },
    "/api/budget/expenses/{budgetId}": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Get the list of budgets",
        "description": "Get all budgets related to the authenticated user",
        "operationId": "getExpenses",
        "parameters": [
          {
            "name": "budgetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully got expenses",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ExpenseResponseDTO"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/budget/expense/{expenseId}": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Get the expense",
        "description": "Get expense by its id ",
        "operationId": "getExpense",
        "parameters": [
          {
            "name": "expenseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully got expense",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseResponseDTO"
                }
              }
            }
          },
          "500": {
            "description": "Expense is not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseResponseDTO"
                }
              }
            }
          }
        }
      }
    },
    "/api/budget/delete/{budgetId}": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Deletes a budget",
        "description": "Deletes a budget based on provided budget id",
        "operationId": "deleteBudget",
        "parameters": [
          {
            "name": "budgetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "500": {
            "description": "Budget is not found",
heikkkk's avatar
heikkkk committed
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "200": {
            "description": "Successfully deleted budget",
heikkkk's avatar
heikkkk committed
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/budget/delete/expense/{expenseId}": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Deletes an expense",
        "description": "Deletes an expense based on provided expense id",
        "operationId": "deleteExpense",
        "parameters": [
          {
            "name": "expenseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully deleted expense",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "500": {
            "description": "Expense is not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "TransactionDTO": {
        "type": "object",
        "properties": {
          "debtorBBAN": {
            "type": "integer",
            "format": "int64"
          },
          "creditorBBAN": {
            "type": "integer",
            "format": "int64"
          },
          "amount": {
            "type": "number"
          }
        }
      },
      "BankProfileDTO": {
        "type": "object",
        "properties": {
          "ssn": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "Account": {
        "type": "object",
        "properties": {
          "bban": {
            "type": "integer",
            "format": "int64"
          },
          "balance": {
            "type": "number"
          },
          "bankProfile": {
            "$ref": "#/components/schemas/BankProfile"
          }
        }
      },
      "BankProfile": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "ssn": {
            "type": "integer",
            "format": "int64"
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Account"
            }
          }
        }
      },
      "BankProfileResponseDTO": {
        "type": "object",
        "properties": {
          "ssn": {
            "type": "integer",
            "format": "int64"
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Account"
            }
          }
        }
      },
      "AccountRequestDTO": {
        "type": "object",
        "properties": {
          "ssn": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "AccountResponseDTO": {
        "type": "object",
        "properties": {
          "bankProfileId": {
            "type": "integer",
            "format": "int64"
          },
          "balance": {
            "type": "number"
          }
        }
      },
      "FeedbackRequestDTO": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
heikkkk's avatar
heikkkk committed
      "PasswordResetDTO": {
        "required": [
          "token"
        ],
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          },
          "password": {
            "type": "string"
          }
        }
      },
      "CreateGoalDTO": {
        "type": "object",
        "properties": {
          "name": {
heikkkk's avatar
heikkkk committed
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "targetAmount": {
            "type": "number"
heikkkk's avatar
heikkkk committed
          },
          "targetDate": {
            "type": "string"
heikkkk's avatar
heikkkk committed
          }
        }
      },
      "ChallengeDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "amount": {
            "type": "number"
          },
          "points": {
heikkkk's avatar
heikkkk committed
            "type": "integer",
            "format": "int32"
          },
          "checkDays": {
heikkkk's avatar
heikkkk committed
            "type": "integer",
            "format": "int32"
          },
          "totalDays": {
heikkkk's avatar
heikkkk committed
            "type": "integer",
            "format": "int32"
          },
          "startDate": {
heikkkk's avatar
heikkkk committed
            "type": "string",
            "format": "date-time"
          },
          "endDate": {
            "type": "string",
            "format": "date-time"
          },
          "challengeTemplate": {
            "$ref": "#/components/schemas/ChallengeTemplateDTO"
          },
          "progressList": {
heikkkk's avatar
heikkkk committed
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProgressDTO"
      "ChallengeTemplateDTO": {
heikkkk's avatar
heikkkk committed
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "text": {
            "type": "string"
heikkkk's avatar
heikkkk committed
          },
          "amount": {
            "type": "number"
          },
          "type": {
heikkkk's avatar
heikkkk committed
            "type": "string",
            "enum": [
              "NO_COFFEE",
              "NO_CAR",
              "SHORTER_SHOWER",
              "SPEND_LESS_ON_FOOD",
              "BUY_USED_CLOTHES",
              "LESS_SHOPPING",
              "DROP_SUBSCRIPTION",
              "SELL_SOMETHING",
              "BUY_USED",
              "EAT_PACKED_LUNCH",
              "STOP_SHOPPING",
              "ZERO_SPENDING",
              "RENT_YOUR_STUFF",
              "MEATLESS",
              "SCREEN_TIME_LIMIT",
              "UNPLUGGED_ENTERTAINMENT"
            ]
heikkkk's avatar
heikkkk committed
          }
        }
      },
      "GoalDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
heikkkk's avatar
heikkkk committed
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "targetAmount": {
            "type": "number"
heikkkk's avatar
heikkkk committed
          },
          "targetDate": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "challenges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChallengeDTO"
            }
          },
          "user": {
            "$ref": "#/components/schemas/UserDTO"
heikkkk's avatar
heikkkk committed
          }
        }
      },
      "ProgressDTO": {
heikkkk's avatar
heikkkk committed
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
heikkkk's avatar
heikkkk committed
          },
          "day": {
            "type": "integer",
            "format": "int32"
          },
          "amount": {
            "type": "number"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time"
heikkkk's avatar
heikkkk committed
          }
        }
      },
      "UserDTO": {
heikkkk's avatar
heikkkk committed
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
heikkkk's avatar
heikkkk committed
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "profileImage": {
            "type": "integer",
            "format": "int64"
          },
          "email": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "role": {
            "type": "string"
          },
          "subscriptionLevel": {
            "type": "string"
          }
        }
      },
      "MarkChallengeDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "day": {
            "type": "integer",
            "format": "int32"