diff --git a/spec.json b/spec.json index e6566e8325cdbf7dd17a2bb0286b7fe42273b085..b039c7ca04d723074bf962c7e5069a03b39e5aa5 100644 --- a/spec.json +++ b/spec.json @@ -17,6 +17,10 @@ } ], "tags": [ + { + "name": "Item", + "description": "Endpoints for managing store and user inventory." + }, { "name": "Friend", "description": "API for managing friend relationships" @@ -75,8 +79,8 @@ } ], "responses": { - "404": { - "description": "Friend request not found", + "200": { + "description": "Friend request successfully accepted", "content": { "*/*": { "schema": { @@ -85,8 +89,8 @@ } } }, - "200": { - "description": "Friend request successfully accepted", + "404": { + "description": "Friend request not found", "content": { "*/*": { "schema": { @@ -116,8 +120,8 @@ } ], "responses": { - "404": { - "description": "Friend or friend request not found", + "200": { + "description": "Friend successfully deleted or friend request cancelled", "content": { "*/*": { "schema": { @@ -126,8 +130,8 @@ } } }, - "200": { - "description": "Friend successfully deleted or friend request cancelled", + "404": { + "description": "Friend or friend request not found", "content": { "*/*": { "schema": { @@ -158,8 +162,8 @@ "required": true }, "responses": { - "404": { - "description": "Bank profile id does not exist", + "200": { + "description": "No accounts associated with a bank user", "content": { "*/*": { "schema": { @@ -168,8 +172,8 @@ } } }, - "200": { - "description": "No accounts associated with a bank user", + "404": { + "description": "Bank profile id does not exist", "content": { "*/*": { "schema": { @@ -200,8 +204,8 @@ "required": true }, "responses": { - "400": { - "description": "Could not create profile", + "200": { + "description": "Successfully created a bank profile", "content": { "*/*": { "schema": { @@ -210,8 +214,8 @@ } } }, - "200": { - "description": "Successfully created a bank profile", + "400": { + "description": "Could not create profile", "content": { "*/*": { "schema": { @@ -242,8 +246,8 @@ "required": true }, "responses": { - "404": { - "description": "Provided bank profile id could not be found", + "200": { + "description": "Successfully created account", "content": { "*/*": { "schema": { @@ -252,8 +256,8 @@ } } }, - "200": { - "description": "Successfully created account", + "404": { + "description": "Provided bank profile id could not be found", "content": { "*/*": { "schema": { @@ -335,16 +339,55 @@ "required": true }, "responses": { - "403": { - "description": "Invalid token" - }, "204": { "description": "Password was reset successfully" + }, + "403": { + "description": "Invalid token" } }, "security": [] } }, + "/api/item/{itemId}": { + "post": { + "tags": [ + "Item" + ], + "summary": "Purchase an item", + "description": "Performs a purchase of the item by the user. Points will be deducted from the user.", + "operationId": "buyItem", + "parameters": [ + { + "name": "itemId", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "201": { + "description": "Item purchased and added to inventory successfully", + "content": { + "application/json": {} + } + }, + "403": { + "description": "Insufficient points to purchase the item", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, "/api/images": { "post": { "tags": [ @@ -386,11 +429,36 @@ } } }, - "/api/goal/createGoal": { + "/api/goals": { + "get": { + "tags": [ + "Goal" + ], + "summary": "Get goals", + "description": "Get the goals of the authenticated user", + "operationId": "getGoals", + "responses": { + "200": { + "description": "Successfully retrieved the goals", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/GoalDTO" + } + } + } + } + } + } + }, "post": { "tags": [ - "goal" + "Goal" ], + "summary": "Create a goal", + "description": "Create a new goal", "operationId": "createGoal", "requestBody": { "content": { @@ -402,13 +470,48 @@ }, "required": true }, + "responses": { + "201": { + "description": "Successfully created a goal", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GoalDTO" + } + } + } + } + } + } + }, + "/api/goals/update-challenge": { + "post": { + "tags": [ + "Goal" + ], + "summary": "Update a challenge", + "description": "Update a challenge day as completed", + "operationId": "updateChallenge", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MarkChallengeDTO" + } + } + }, + "required": true + }, "responses": { "200": { - "description": "OK", + "description": "Successfully updated the challenge" + }, + "401": { + "description": "Day is already completed or day outside of range", "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/GoalDTO" + "$ref": "#/components/schemas/ExceptionResponse" } } } @@ -416,6 +519,31 @@ } } }, + "/api/goals/update-challenge-amount": { + "post": { + "tags": [ + "Goal" + ], + "summary": "Update challenge saving amount", + "description": "Update the challenge saving amount", + "operationId": "updateChallengeAmount", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MarkChallengeDTO" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successfully updated the challenge" + } + } + } + }, "/api/friends/{userId}": { "post": { "tags": [ @@ -445,7 +573,7 @@ "/api/budget/update/{budgetId}": { "post": { "tags": [ - "User" + "Budget" ], "summary": "Updates a budget", "description": "Updates a budget based on the budget request", @@ -472,8 +600,8 @@ "required": true }, "responses": { - "500": { - "description": "Budget is not found", + "200": { + "description": "Successfully updated budget", "content": { "application/json": { "schema": { @@ -482,8 +610,8 @@ } } }, - "200": { - "description": "Successfully updated budget", + "500": { + "description": "Budget is not found", "content": { "application/json": { "schema": { @@ -498,7 +626,7 @@ "/api/budget/update/expense/{budgetId}": { "post": { "tags": [ - "User" + "Budget" ], "summary": "Created/Updates an expense", "description": "Creates/Updates a budget based on the budget request", @@ -525,8 +653,8 @@ "required": true }, "responses": { - "500": { - "description": "Error updating expense", + "200": { + "description": "Successfully updated budget", "content": { "application/json": { "schema": { @@ -535,8 +663,8 @@ } } }, - "200": { - "description": "Successfully updated budget", + "500": { + "description": "Error updating expense", "content": { "application/json": { "schema": { @@ -551,7 +679,7 @@ "/api/budget/create": { "post": { "tags": [ - "User" + "Budget" ], "summary": "Create a new budget", "description": "Create a new budget with based on the budget request", @@ -695,8 +823,8 @@ } } }, - "404": { - "description": "User not found", + "401": { + "description": "Invalid credentials", "content": { "application/json": { "schema": { @@ -705,8 +833,8 @@ } } }, - "401": { - "description": "Invalid credentials", + "404": { + "description": "User not found", "content": { "application/json": { "schema": { @@ -884,8 +1012,8 @@ } ], "responses": { - "404": { - "description": "Bank profile id does not exist", + "200": { + "description": "No accounts associated with a bank user", "content": { "*/*": { "schema": { @@ -897,8 +1025,8 @@ } } }, - "200": { - "description": "No accounts associated with a bank user", + "404": { + "description": "Bank profile id does not exist", "content": { "*/*": { "schema": { @@ -1128,6 +1256,29 @@ } } }, + "/api/leaderboard/total-points": { + "get": { + "tags": [ + "Leaderboard" + ], + "summary": "Get sum of total points globally", + "description": "Get the sum of the total points of all users globally", + "operationId": "getTotalPoints", + "responses": { + "200": { + "description": "Successfully retrieved total points", + "content": { + "application/json": { + "schema": { + "type": "integer", + "format": "int64" + } + } + } + } + } + } + }, "/api/leaderboard/surrounding": { "get": { "tags": [ @@ -1176,6 +1327,56 @@ } } }, + "/api/item/store": { + "get": { + "tags": [ + "Item" + ], + "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", + "responses": { + "200": { + "description": "List of store items fetched successfully", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ItemDTO" + } + } + } + } + } + } + } + }, + "/api/item/inventory": { + "get": { + "tags": [ + "Item" + ], + "summary": "Get user inventory items", + "description": "Retrieves a list of all items currently in the inventory of the user.", + "operationId": "getInventory", + "responses": { + "200": { + "description": "List of inventory items fetched successfully", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/InventoryDTO" + } + } + } + } + } + } + } + }, "/api/images/{id}": { "get": { "tags": [ @@ -1196,23 +1397,23 @@ } ], "responses": { - "404": { - "description": "Image not found", + "200": { + "description": "Successfully retrieved the image", "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/ExceptionResponse" + "type": "string", + "format": "binary" } } } }, - "200": { - "description": "Successfully retrieved the image", + "404": { + "description": "Image not found", "content": { "*/*": { "schema": { - "type": "string", - "format": "binary" + "$ref": "#/components/schemas/ExceptionResponse" } } } @@ -1221,60 +1422,17 @@ "security": [] } }, - "/api/goal/getGoals": { + "/api/friends": { "get": { "tags": [ - "goal" + "Friend" ], - "operationId": "getGoals", + "summary": "Get all friends", + "description": "Returns a list of all friends.", + "operationId": "getFriends", "responses": { "200": { - "description": "OK", - "content": { - "*/*": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GoalDTO" - } - } - } - } - } - } - } - }, - "/api/goal/getGoal": { - "get": { - "tags": [ - "goal" - ], - "operationId": "getGoal", - "responses": { - "200": { - "description": "OK", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/GoalDTO" - } - } - } - } - } - } - }, - "/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", + "description": "Successfully retrieved list of friends", "content": { "*/*": { "schema": { @@ -1317,7 +1475,7 @@ "/api/budget": { "get": { "tags": [ - "User" + "Budget" ], "summary": "Get the list of budgets", "description": "Get all budgets related to the authenticated user", @@ -1342,7 +1500,7 @@ "/api/budget/{budgetId}": { "get": { "tags": [ - "User" + "Budget" ], "summary": "Get the budget", "description": "Get budget by its id ", @@ -1359,8 +1517,8 @@ } ], "responses": { - "500": { - "description": "Budget is not found", + "200": { + "description": "Successfully got budget", "content": { "application/json": { "schema": { @@ -1369,8 +1527,8 @@ } } }, - "200": { - "description": "Successfully got budget", + "500": { + "description": "Budget is not found", "content": { "application/json": { "schema": { @@ -1385,7 +1543,7 @@ "/api/budget/expenses/{budgetId}": { "get": { "tags": [ - "User" + "Budget" ], "summary": "Get the list of budgets", "description": "Get all budgets related to the authenticated user", @@ -1421,7 +1579,7 @@ "/api/budget/expense/{expenseId}": { "get": { "tags": [ - "User" + "Budget" ], "summary": "Get the expense", "description": "Get expense by its id ", @@ -1464,7 +1622,7 @@ "/api/budget/delete/{budgetId}": { "get": { "tags": [ - "User" + "Budget" ], "summary": "Deletes a budget", "description": "Deletes a budget based on provided budget id", @@ -1481,8 +1639,8 @@ } ], "responses": { - "500": { - "description": "Budget is not found", + "200": { + "description": "Successfully deleted budget", "content": { "application/json": { "schema": { @@ -1491,8 +1649,8 @@ } } }, - "200": { - "description": "Successfully deleted budget", + "500": { + "description": "Budget is not found", "content": { "application/json": { "schema": { @@ -1507,7 +1665,7 @@ "/api/budget/delete/expense/{expenseId}": { "get": { "tags": [ - "User" + "Budget" ], "summary": "Deletes an expense", "description": "Deletes an expense based on provided expense id", @@ -1546,6 +1704,146 @@ } } } + }, + "/api/badge": { + "get": { + "tags": [ + "Badge" + ], + "summary": "Get the list of badges", + "description": "Get all badges stored in the database", + "operationId": "getAllBadges", + "responses": { + "200": { + "description": "Successfully got badges", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BadgeDTO" + } + } + } + } + } + } + } + }, + "/api/badge/{badgeId}": { + "get": { + "tags": [ + "Badge" + ], + "summary": "Get the budget", + "description": "Get budget by its id ", + "operationId": "getBadge", + "parameters": [ + { + "name": "badgeId", + "in": "path", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "Successfully got budget", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadgeDTO" + } + } + } + }, + "500": { + "description": "Badge is not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadgeDTO" + } + } + } + } + } + } + }, + "/api/badge/update": { + "get": { + "tags": [ + "Badge" + ], + "summary": "Updates unlocked badges", + "description": "Checks if a user has met the criteria for unlocking badges", + "operationId": "updateUnlockedBadges", + "responses": { + "200": { + "description": "Successfully updated badges", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/api/badge/unlocked": { + "get": { + "tags": [ + "Badge" + ], + "summary": "Get the list of badges", + "description": "Get all badges unlocked by the user", + "operationId": "getBadgesUnlockedByUser", + "responses": { + "200": { + "description": "Successfully got badges", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BadgeDTO" + } + } + } + } + } + } + } + }, + "/api/badge/locked": { + "get": { + "tags": [ + "Badge" + ], + "summary": "Get the list of badges", + "description": "Get all badges not unlocked by the user", + "operationId": "getBadgesNotUnlockedByUser", + "responses": { + "200": { + "description": "Successfully got badges", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BadgeDTO" + } + } + } + } + } + } + } } }, "components": { @@ -1673,19 +1971,17 @@ "CreateGoalDTO": { "type": "object", "properties": { - "goalName": { + "name": { "type": "string" }, "description": { "type": "string" }, "targetAmount": { - "type": "integer", - "format": "int32" + "type": "number" }, "targetDate": { - "type": "string", - "format": "date-time" + "type": "string" } } }, @@ -1696,44 +1992,73 @@ "type": "integer", "format": "int64" }, - "potentialSavingAmount": { + "amount": { + "type": "number" + }, + "points": { "type": "integer", "format": "int32" }, - "points": { + "checkDays": { "type": "integer", "format": "int32" }, - "days": { + "totalDays": { "type": "integer", "format": "int32" }, - "createdAt": { + "startDate": { + "type": "string", + "format": "date-time" + }, + "endDate": { "type": "string", "format": "date-time" }, - "dailyChallengeProgressList": { + "challengeTemplate": { + "$ref": "#/components/schemas/ChallengeTemplateDTO" + }, + "progressList": { "type": "array", "items": { - "$ref": "#/components/schemas/DailyChallengeProgressDTO" + "$ref": "#/components/schemas/ProgressDTO" } } } }, - "DailyChallengeProgressDTO": { + "ChallengeTemplateDTO": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, - "challengeDay": { - "type": "integer", - "format": "int32" + "text": { + "type": "string" }, - "completedAt": { + "amount": { + "type": "number" + }, + "type": { "type": "string", - "format": "date-time" + "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" + ] } } }, @@ -1744,24 +2069,19 @@ "type": "integer", "format": "int64" }, - "goalName": { + "name": { "type": "string" }, "description": { "type": "string" }, "targetAmount": { - "type": "integer", - "format": "int32" + "type": "number" }, "targetDate": { "type": "string", "format": "date-time" }, - "completedAt": { - "type": "string", - "format": "date-time" - }, "createdAt": { "type": "string", "format": "date-time" @@ -1772,37 +2092,88 @@ "$ref": "#/components/schemas/ChallengeDTO" } }, - "participants": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ParticipantDTO" - } + "user": { + "$ref": "#/components/schemas/UserDTO" } } }, - "ParticipantDTO": { + "ProgressDTO": { "type": "object", "properties": { - "role": { - "type": "string", - "enum": [ - "CREATOR", - "CONTRIBUTOR" - ] + "id": { + "type": "integer", + "format": "int64" }, - "user": { - "$ref": "#/components/schemas/ParticipantUserDTO" + "day": { + "type": "integer", + "format": "int32" + }, + "amount": { + "type": "number" + }, + "completedAt": { + "type": "string", + "format": "date-time" } } }, - "ParticipantUserDTO": { + "UserDTO": { "type": "object", "properties": { + "id": { + "type": "integer", + "format": "int64" + }, "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" + }, + "amount": { + "type": "number" + } + } + }, + "ExceptionResponse": { + "type": "object", + "properties": { + "status": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" } } }, @@ -1835,18 +2206,6 @@ } } }, - "ExceptionResponse": { - "type": "object", - "properties": { - "status": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - }, "ConfigurationDTO": { "type": "object", "properties": { @@ -1947,38 +2306,6 @@ } } }, - "UserDTO": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "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" - } - } - }, "BankAccountDTO": { "type": "object", "properties": { @@ -2076,6 +2403,49 @@ } } }, + "ItemDTO": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "itemName": { + "type": "string" + }, + "price": { + "type": "integer", + "format": "int32" + }, + "imageId": { + "type": "integer", + "format": "int64" + }, + "alreadyBought": { + "type": "boolean" + } + } + }, + "InventoryDTO": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "itemName": { + "type": "string" + }, + "imageId": { + "type": "integer", + "format": "int64" + }, + "boughtAt": { + "type": "string", + "format": "date-time" + } + } + }, "BudgetResponseDTO": { "type": "object", "properties": { @@ -2116,6 +2486,26 @@ "type": "string" } } + }, + "BadgeDTO": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "badgeName": { + "type": "string" + }, + "criteria": { + "type": "integer", + "format": "int32" + }, + "imageId": { + "type": "integer", + "format": "int64" + } + } } }, "securitySchemes": { diff --git a/src/api/models/BadgeDTO.ts b/src/api/models/BadgeDTO.ts new file mode 100644 index 0000000000000000000000000000000000000000..9fd3d054da77c4e8adcef24d0a2853b0bba641f5 --- /dev/null +++ b/src/api/models/BadgeDTO.ts @@ -0,0 +1,11 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type BadgeDTO = { + id?: number; + badgeName?: string; + criteria?: number; + imageId?: number; +}; + diff --git a/src/api/models/ChallengeTemplateDTO.ts b/src/api/models/ChallengeTemplateDTO.ts new file mode 100644 index 0000000000000000000000000000000000000000..323e64de48b8a201d3c4da78e5de83a904b0b0b1 --- /dev/null +++ b/src/api/models/ChallengeTemplateDTO.ts @@ -0,0 +1,31 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ChallengeTemplateDTO = { + id?: number; + text?: string; + amount?: number; + type?: ChallengeTemplateDTO.type; +}; +export namespace ChallengeTemplateDTO { + export enum type { + NO_COFFEE = 'NO_COFFEE', + NO_CAR = 'NO_CAR', + SHORTER_SHOWER = 'SHORTER_SHOWER', + SPEND_LESS_ON_FOOD = 'SPEND_LESS_ON_FOOD', + BUY_USED_CLOTHES = 'BUY_USED_CLOTHES', + LESS_SHOPPING = 'LESS_SHOPPING', + DROP_SUBSCRIPTION = 'DROP_SUBSCRIPTION', + SELL_SOMETHING = 'SELL_SOMETHING', + BUY_USED = 'BUY_USED', + EAT_PACKED_LUNCH = 'EAT_PACKED_LUNCH', + STOP_SHOPPING = 'STOP_SHOPPING', + ZERO_SPENDING = 'ZERO_SPENDING', + RENT_YOUR_STUFF = 'RENT_YOUR_STUFF', + MEATLESS = 'MEATLESS', + SCREEN_TIME_LIMIT = 'SCREEN_TIME_LIMIT', + UNPLUGGED_ENTERTAINMENT = 'UNPLUGGED_ENTERTAINMENT', + } +} + diff --git a/src/api/models/InventoryDTO.ts b/src/api/models/InventoryDTO.ts new file mode 100644 index 0000000000000000000000000000000000000000..826a6b61da10137a07982263be585d3be2571bfa --- /dev/null +++ b/src/api/models/InventoryDTO.ts @@ -0,0 +1,11 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type InventoryDTO = { + id?: number; + itemName?: string; + imageId?: number; + boughtAt?: string; +}; + diff --git a/src/api/models/ItemDTO.ts b/src/api/models/ItemDTO.ts new file mode 100644 index 0000000000000000000000000000000000000000..b2c65c3135bb7307dd11c25a5c4defe7781af209 --- /dev/null +++ b/src/api/models/ItemDTO.ts @@ -0,0 +1,12 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ItemDTO = { + id?: number; + itemName?: string; + price?: number; + imageId?: number; + alreadyBought?: boolean; +}; + diff --git a/src/api/models/ParticipantUserDTO.ts b/src/api/models/MarkChallengeDTO.ts similarity index 60% rename from src/api/models/ParticipantUserDTO.ts rename to src/api/models/MarkChallengeDTO.ts index 5499c09f765c2b01e58efea75581a8f14d3f9e40..09c06b8a91f40448ceb2fe25867da13de7f713cb 100644 --- a/src/api/models/ParticipantUserDTO.ts +++ b/src/api/models/MarkChallengeDTO.ts @@ -2,8 +2,9 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type ParticipantUserDTO = { - firstName?: string; - lastName?: string; +export type MarkChallengeDTO = { + id?: number; + day?: number; + amount?: number; }; diff --git a/src/api/models/ParticipantDTO.ts b/src/api/models/ParticipantDTO.ts deleted file mode 100644 index 0615b50834924e46416818dffbb00718b3607bab..0000000000000000000000000000000000000000 --- a/src/api/models/ParticipantDTO.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* generated using openapi-typescript-codegen -- do not edit */ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ParticipantUserDTO } from './ParticipantUserDTO'; -export type ParticipantDTO = { - role?: ParticipantDTO.role; - user?: ParticipantUserDTO; -}; -export namespace ParticipantDTO { - export enum role { - CREATOR = 'CREATOR', - CONTRIBUTOR = 'CONTRIBUTOR', - } -} - diff --git a/src/api/models/ProgressDTO.ts b/src/api/models/ProgressDTO.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb6f11746458912e9efef6438bb3278ff585c2d6 --- /dev/null +++ b/src/api/models/ProgressDTO.ts @@ -0,0 +1,11 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ProgressDTO = { + id?: number; + day?: number; + amount?: number; + completedAt?: string; +}; + diff --git a/src/api/services/BadgeService.ts b/src/api/services/BadgeService.ts new file mode 100644 index 0000000000000000000000000000000000000000..f014b589ece802008c9e9da2669308001665c046 --- /dev/null +++ b/src/api/services/BadgeService.ts @@ -0,0 +1,80 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { BadgeDTO } from '../models/BadgeDTO'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class BadgeService { + /** + * Get the list of badges + * Get all badges stored in the database + * @returns BadgeDTO Successfully got badges + * @throws ApiError + */ + public static getAllBadges(): CancelablePromise<Array<BadgeDTO>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/badge', + }); + } + /** + * Get the budget + * Get budget by its id + * @returns BadgeDTO Successfully got budget + * @throws ApiError + */ + public static getBadge({ + badgeId, + }: { + badgeId: number, + }): CancelablePromise<BadgeDTO> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/badge/{badgeId}', + path: { + 'badgeId': badgeId, + }, + errors: { + 500: `Badge is not found`, + }, + }); + } + /** + * Updates unlocked badges + * Checks if a user has met the criteria for unlocking badges + * @returns any Successfully updated badges + * @throws ApiError + */ + public static updateUnlockedBadges(): CancelablePromise<Record<string, any>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/badge/update', + }); + } + /** + * Get the list of badges + * Get all badges unlocked by the user + * @returns BadgeDTO Successfully got badges + * @throws ApiError + */ + public static getBadgesUnlockedByUser(): CancelablePromise<Array<BadgeDTO>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/badge/unlocked', + }); + } + /** + * Get the list of badges + * Get all badges not unlocked by the user + * @returns BadgeDTO Successfully got badges + * @throws ApiError + */ + public static getBadgesNotUnlockedByUser(): CancelablePromise<Array<BadgeDTO>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/badge/locked', + }); + } +} diff --git a/src/api/services/BudgetService.ts b/src/api/services/BudgetService.ts new file mode 100644 index 0000000000000000000000000000000000000000..219c866aa5f4ed51c86e3d10404e1e197898be1d --- /dev/null +++ b/src/api/services/BudgetService.ts @@ -0,0 +1,202 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { BudgetRequestDTO } from '../models/BudgetRequestDTO'; +import type { BudgetResponseDTO } from '../models/BudgetResponseDTO'; +import type { ExpenseRequestDTO } from '../models/ExpenseRequestDTO'; +import type { ExpenseResponseDTO } from '../models/ExpenseResponseDTO'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class BudgetService { + /** + * Updates a budget + * Updates a budget based on the budget request + * @returns any Successfully updated budget + * @throws ApiError + */ + public static updateBudget({ + budgetId, + requestBody, + }: { + budgetId: number, + requestBody: BudgetRequestDTO, + }): CancelablePromise<Record<string, any>> { + return __request(OpenAPI, { + method: 'POST', + url: '/api/budget/update/{budgetId}', + path: { + 'budgetId': budgetId, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 500: `Budget is not found`, + }, + }); + } + /** + * Created/Updates an expense + * Creates/Updates a budget based on the budget request + * @returns any Successfully updated budget + * @throws ApiError + */ + public static updateExpense({ + budgetId, + requestBody, + }: { + budgetId: number, + requestBody: ExpenseRequestDTO, + }): CancelablePromise<Record<string, any>> { + return __request(OpenAPI, { + method: 'POST', + url: '/api/budget/update/expense/{budgetId}', + path: { + 'budgetId': budgetId, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 500: `Error updating expense`, + }, + }); + } + /** + * Create a new budget + * Create a new budget with based on the budget request + * @returns any Successfully created new budget + * @throws ApiError + */ + public static createBudget({ + requestBody, + }: { + requestBody: BudgetRequestDTO, + }): CancelablePromise<Record<string, any>> { + return __request(OpenAPI, { + method: 'POST', + url: '/api/budget/create', + body: requestBody, + mediaType: 'application/json', + }); + } + /** + * Get the list of budgets + * Get all budgets related to the authenticated user + * @returns BudgetResponseDTO Successfully got budgets + * @throws ApiError + */ + public static getBudgetsByUser(): CancelablePromise<Array<BudgetResponseDTO>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/budget', + }); + } + /** + * Get the budget + * Get budget by its id + * @returns BudgetResponseDTO Successfully got budget + * @throws ApiError + */ + public static getBudget({ + budgetId, + }: { + budgetId: number, + }): CancelablePromise<BudgetResponseDTO> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/budget/{budgetId}', + path: { + 'budgetId': budgetId, + }, + errors: { + 500: `Budget is not found`, + }, + }); + } + /** + * Get the list of budgets + * Get all budgets related to the authenticated user + * @returns ExpenseResponseDTO Successfully got expenses + * @throws ApiError + */ + public static getExpenses({ + budgetId, + }: { + budgetId: number, + }): CancelablePromise<Array<ExpenseResponseDTO>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/budget/expenses/{budgetId}', + path: { + 'budgetId': budgetId, + }, + }); + } + /** + * Get the expense + * Get expense by its id + * @returns ExpenseResponseDTO Successfully got expense + * @throws ApiError + */ + public static getExpense({ + expenseId, + }: { + expenseId: number, + }): CancelablePromise<ExpenseResponseDTO> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/budget/expense/{expenseId}', + path: { + 'expenseId': expenseId, + }, + errors: { + 500: `Expense is not found`, + }, + }); + } + /** + * Deletes a budget + * Deletes a budget based on provided budget id + * @returns any Successfully deleted budget + * @throws ApiError + */ + public static deleteBudget({ + budgetId, + }: { + budgetId: number, + }): CancelablePromise<Record<string, any>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/budget/delete/{budgetId}', + path: { + 'budgetId': budgetId, + }, + errors: { + 500: `Budget is not found`, + }, + }); + } + /** + * Deletes an expense + * Deletes an expense based on provided expense id + * @returns any Successfully deleted expense + * @throws ApiError + */ + public static deleteExpense({ + expenseId, + }: { + expenseId: number, + }): CancelablePromise<Record<string, any>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/budget/delete/expense/{expenseId}', + path: { + 'expenseId': expenseId, + }, + errors: { + 500: `Expense is not found`, + }, + }); + } +} diff --git a/src/api/services/ItemService.ts b/src/api/services/ItemService.ts new file mode 100644 index 0000000000000000000000000000000000000000..ae2a3a8997ee79ac0fd22e289c153666a79b7396 --- /dev/null +++ b/src/api/services/ItemService.ts @@ -0,0 +1,57 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { InventoryDTO } from '../models/InventoryDTO'; +import type { ItemDTO } from '../models/ItemDTO'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class ItemService { + /** + * Purchase an item + * Performs a purchase of the item by the user. Points will be deducted from the user. + * @returns any Item purchased and added to inventory successfully + * @throws ApiError + */ + public static buyItem({ + itemId, + }: { + itemId: number, + }): CancelablePromise<any> { + return __request(OpenAPI, { + method: 'POST', + url: '/api/item/{itemId}', + path: { + 'itemId': itemId, + }, + errors: { + 403: `Insufficient points to purchase the item`, + }, + }); + } + /** + * Get available store items + * Retrieves all items available in the store and a flag indicating whether the user has purchased each item. + * @returns ItemDTO List of store items fetched successfully + * @throws ApiError + */ + public static getStore(): CancelablePromise<Array<ItemDTO>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/item/store', + }); + } + /** + * Get user inventory items + * Retrieves a list of all items currently in the inventory of the user. + * @returns InventoryDTO List of inventory items fetched successfully + * @throws ApiError + */ + public static getInventory(): CancelablePromise<Array<InventoryDTO>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/item/inventory', + }); + } +} diff --git a/src/components/Login/LoginForm.vue b/src/components/Login/LoginForm.vue index 0ef2798aab894ad01405e13392ac9ccc1b3a3ec4..a8f426cb558b7e55d6c6bf53c79ab42e026226fc 100644 --- a/src/components/Login/LoginForm.vue +++ b/src/components/Login/LoginForm.vue @@ -20,12 +20,10 @@ const userStore = useUserInfoStore(); const handleEmailInputEvent = (newValue: any) => { emailRef.value = newValue - console.log(emailRef.value) } const handlePasswordInputEvent = (newValue: any) => { passwordRef.value = newValue - console.log(passwordRef.value) } const handleSubmit = async () => { @@ -65,7 +63,7 @@ const handleSubmit = async () => { profileImage: response.profileImage }); - console.log() + console.log(response.token) await router.push({ name: 'home' }); } catch (error: any) {