diff --git a/src/api/models/AuthenticationResponse.ts b/src/api/models/AuthenticationResponse.ts index 47169ae37b90b20523c9be17ff5da7c2b15bcd4a..3cbef78cec18fdd088dc5349ec155fdfc9ae8b02 100644 --- a/src/api/models/AuthenticationResponse.ts +++ b/src/api/models/AuthenticationResponse.ts @@ -5,7 +5,10 @@ export type AuthenticationResponse = { firstName?: string; lastName?: string; + userId?: number; + profileImage?: number; role?: string; + subscriptionLevel?: string; token?: string; }; diff --git a/src/api/models/ChallengeDTO.ts b/src/api/models/ChallengeDTO.ts index f5bd38d483c363d921274e9ed77dbd5e6d4aef75..3ccf0f055c0ffb92c2f2612a02aaf5e25d3c856b 100644 --- a/src/api/models/ChallengeDTO.ts +++ b/src/api/models/ChallengeDTO.ts @@ -2,13 +2,17 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -import type { DailyChallengeProgressDTO } from './DailyChallengeProgressDTO'; +import type { ChallengeTemplateDTO } from './ChallengeTemplateDTO'; +import type { ProgressDTO } from './ProgressDTO'; export type ChallengeDTO = { id?: number; - potentialSavingAmount?: number; + amount?: number; points?: number; - days?: number; - createdAt?: string; - dailyChallengeProgressList?: Array<DailyChallengeProgressDTO>; + checkDays?: number; + totalDays?: number; + startDate?: string; + endDate?: string; + challengeTemplate?: ChallengeTemplateDTO; + progressList?: Array<ProgressDTO>; }; 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/CreateGoalDTO.ts b/src/api/models/CreateGoalDTO.ts index 61eb0457b42b2aebf8be3c560bcd62d2346648e4..2e6e535f0b0a2317ef26e76c8db8f53572cbcd8d 100644 --- a/src/api/models/CreateGoalDTO.ts +++ b/src/api/models/CreateGoalDTO.ts @@ -3,7 +3,7 @@ /* tslint:disable */ /* eslint-disable */ export type CreateGoalDTO = { - goalName?: string; + name?: string; description?: string; targetAmount?: number; targetDate?: string; diff --git a/src/api/models/ParticipantUserDTO.ts b/src/api/models/FeedbackRequestDTO.ts similarity index 62% rename from src/api/models/ParticipantUserDTO.ts rename to src/api/models/FeedbackRequestDTO.ts index 5499c09f765c2b01e58efea75581a8f14d3f9e40..174e9eff582bc5a724980e15fcb6341a50d4acaa 100644 --- a/src/api/models/ParticipantUserDTO.ts +++ b/src/api/models/FeedbackRequestDTO.ts @@ -2,8 +2,8 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type ParticipantUserDTO = { - firstName?: string; - lastName?: string; +export type FeedbackRequestDTO = { + email?: string; + message?: string; }; diff --git a/src/api/models/FeedbackResponseDTO.ts b/src/api/models/FeedbackResponseDTO.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b249002ad1e5b596541e138c7ac6e34eef093f0 --- /dev/null +++ b/src/api/models/FeedbackResponseDTO.ts @@ -0,0 +1,11 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type FeedbackResponseDTO = { + id?: string; + email?: string; + message?: string; + createdAt?: string; +}; + diff --git a/src/api/models/GoalDTO.ts b/src/api/models/GoalDTO.ts index 004eb49fd0bec010a1d4227bac6ec6bbc3daea50..c24e9abfb1d37acc49db64803d4da80a901960ce 100644 --- a/src/api/models/GoalDTO.ts +++ b/src/api/models/GoalDTO.ts @@ -3,16 +3,15 @@ /* tslint:disable */ /* eslint-disable */ import type { ChallengeDTO } from './ChallengeDTO'; -import type { ParticipantDTO } from './ParticipantDTO'; +import type { UserDTO } from './UserDTO'; export type GoalDTO = { id?: number; - goalName?: string; + name?: string; description?: string; targetAmount?: number; targetDate?: string; - completedAt?: string; createdAt?: string; challenges?: Array<ChallengeDTO>; - participants?: Array<ParticipantDTO>; + user?: UserDTO; }; diff --git a/src/api/models/DailyChallengeProgressDTO.ts b/src/api/models/InventoryDTO.ts similarity index 61% rename from src/api/models/DailyChallengeProgressDTO.ts rename to src/api/models/InventoryDTO.ts index c7bda736cefef3aebff0533272807cde205e16ee..826a6b61da10137a07982263be585d3be2571bfa 100644 --- a/src/api/models/DailyChallengeProgressDTO.ts +++ b/src/api/models/InventoryDTO.ts @@ -2,9 +2,10 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export type DailyChallengeProgressDTO = { +export type InventoryDTO = { id?: number; - challengeDay?: number; - completedAt?: string; + 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/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/UserDTO.ts b/src/api/models/UserDTO.ts index aee3ea036af88cba3a66ffeb071041105d318d8b..2020ee7c36cf2f4a1a8304f61f398d76c8d5cda2 100644 --- a/src/api/models/UserDTO.ts +++ b/src/api/models/UserDTO.ts @@ -10,5 +10,6 @@ export type UserDTO = { email?: string; createdAt?: string; role?: string; + subscriptionLevel?: string; }; diff --git a/src/api/services/GoalService.ts b/src/api/services/GoalService.ts index 28ae857fcaf1e5268dc6aefc5ba9c9e0d27398f2..b3bfa72d953cab2252919fc7ab21566db845e51f 100644 --- a/src/api/services/GoalService.ts +++ b/src/api/services/GoalService.ts @@ -4,12 +4,27 @@ /* eslint-disable */ import type { CreateGoalDTO } from '../models/CreateGoalDTO'; import type { GoalDTO } from '../models/GoalDTO'; +import type { MarkChallengeDTO } from '../models/MarkChallengeDTO'; import type { CancelablePromise } from '../core/CancelablePromise'; import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class GoalService { /** - * @returns GoalDTO OK + * Get goals + * Get the goals of the authenticated user + * @returns GoalDTO Successfully retrieved the goals + * @throws ApiError + */ + public static getGoals(): CancelablePromise<Array<GoalDTO>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/goals', + }); + } + /** + * Create a goal + * Create a new goal + * @returns GoalDTO Successfully created a goal * @throws ApiError */ public static createGoal({ @@ -19,29 +34,65 @@ export class GoalService { }): CancelablePromise<GoalDTO> { return __request(OpenAPI, { method: 'POST', - url: '/api/goal/createGoal', + url: '/api/goals', body: requestBody, mediaType: 'application/json', }); } /** - * @returns GoalDTO OK + * Update a challenge + * Update a challenge day as completed + * @returns any Successfully updated the challenge * @throws ApiError */ - public static getGoals(): CancelablePromise<Array<GoalDTO>> { + public static updateChallenge({ + requestBody, + }: { + requestBody: MarkChallengeDTO, + }): CancelablePromise<any> { return __request(OpenAPI, { - method: 'GET', - url: '/api/goal/getGoals', + method: 'POST', + url: '/api/goals/update-challenge', + body: requestBody, + mediaType: 'application/json', + errors: { + 401: `Day is already completed or day outside of range`, + }, + }); + } + /** + * Update challenge saving amount + * Update the challenge saving amount + * @returns any Successfully updated the challenge + * @throws ApiError + */ + public static updateChallengeAmount({ + requestBody, + }: { + requestBody: MarkChallengeDTO, + }): CancelablePromise<any> { + return __request(OpenAPI, { + method: 'POST', + url: '/api/goals/update-challenge-amount', + body: requestBody, + mediaType: 'application/json', }); } /** * @returns GoalDTO OK * @throws ApiError */ - public static getGoal(): CancelablePromise<GoalDTO> { + public static getGoal({ + id, + }: { + id: number, + }): CancelablePromise<GoalDTO> { return __request(OpenAPI, { method: 'GET', - url: '/api/goal/getGoal', + url: '/api/goals/{id}', + query: { + 'id': id, + }, }); } } 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/api/services/LeaderboardService.ts b/src/api/services/LeaderboardService.ts index f77a3cc9b2e67de48357385ed47ae8c523b2c0e0..8a38209a1808d6879f636efd4613b5f53b65f23c 100644 --- a/src/api/services/LeaderboardService.ts +++ b/src/api/services/LeaderboardService.ts @@ -30,6 +30,18 @@ export class LeaderboardService { }, }); } + /** + * Get sum of total points globally + * Get the sum of the total points of all users globally + * @returns number Successfully retrieved total points + * @throws ApiError + */ + public static getTotalPoints(): CancelablePromise<number> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/leaderboard/total-points', + }); + } /** * @returns LeaderboardDTO OK * @throws ApiError diff --git a/src/api/services/UserService.ts b/src/api/services/UserService.ts index e7b80041bff94cbc4a17e041ead118b85b9db970..593418a27bb5f5beb68aa4d7d017da91be1df7a3 100644 --- a/src/api/services/UserService.ts +++ b/src/api/services/UserService.ts @@ -8,6 +8,8 @@ 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 { FeedbackRequestDTO } from '../models/FeedbackRequestDTO'; +import type { FeedbackResponseDTO } from '../models/FeedbackResponseDTO'; import type { PasswordResetDTO } from '../models/PasswordResetDTO'; import type { PasswordUpdateDTO } from '../models/PasswordUpdateDTO'; import type { ProfileDTO } from '../models/ProfileDTO'; @@ -17,6 +19,43 @@ import type { CancelablePromise } from '../core/CancelablePromise'; import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class UserService { + /** + * Update User Subscription Level + * Updates the subscription level of the current user + * @returns any Subscription level updated successfully + * @throws ApiError + */ + public static updateSubscriptionLevel({ + subscriptionLevel, + }: { + subscriptionLevel: string, + }): CancelablePromise<Record<string, any>> { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/users/subscription/{subscriptionLevel}', + path: { + 'subscriptionLevel': subscriptionLevel, + }, + }); + } + /** + * Send feedback + * Send feedback from an email. + * @returns any Success + * @throws ApiError + */ + public static sendFeedback({ + requestBody, + }: { + requestBody: FeedbackRequestDTO, + }): CancelablePromise<any> { + return __request(OpenAPI, { + method: 'POST', + url: '/api/users/send-feedback', + body: requestBody, + mediaType: 'application/json', + }); + } /** * Initiate a password reset * Send a password reset mail to the user with the specified email @@ -199,6 +238,50 @@ export class UserService { }, }); } + /** + * Search for users by name and filter + * Returns a list of users whose names contain the specified search term and match the filter. + * @returns UserDTO Successfully retrieved list of users + * @throws ApiError + */ + public static getUsersByNameAndFilter({ + searchTerm, + filter, + }: { + searchTerm: string, + filter: string, + }): CancelablePromise<Array<UserDTO>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/users/search/{searchTerm}/{filter}', + path: { + 'searchTerm': searchTerm, + 'filter': filter, + }, + }); + } + /** + * Get X amount of random users + * Get X amount of random users that fit the filter + * @returns UserDTO Successfully retrieved list of users + * @throws ApiError + */ + public static getRandomUsers({ + amount, + filter, + }: { + amount: number, + filter: string, + }): CancelablePromise<Array<UserDTO>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/users/search/random/{amount}/{filter}', + path: { + 'amount': amount, + 'filter': filter, + }, + }); + } /** * Get the authenticated user * Get all user information for the authenticated user @@ -211,6 +294,18 @@ export class UserService { url: '/api/users/me', }); } + /** + * Send feedback + * Send feedback from a user. + * @returns FeedbackResponseDTO Success + * @throws ApiError + */ + public static getFeedback(): CancelablePromise<Array<FeedbackResponseDTO>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/users/get-feedback', + }); + } /** * Get the list of budgets * Get all budgets related to the authenticated user