Skip to content
Snippets Groups Projects
Commit f5d68755 authored by Victor Ekholt Gunrell Kaste's avatar Victor Ekholt Gunrell Kaste
Browse files

feat: Updating API frontend

parent a1ff1303
No related branches found
No related tags found
1 merge request!69Feat/redesign roadmap
......@@ -5,7 +5,10 @@
export type AuthenticationResponse = {
firstName?: string;
lastName?: string;
userId?: number;
profileImage?: number;
role?: string;
subscriptionLevel?: string;
token?: string;
};
......@@ -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>;
};
/* 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',
}
}
......@@ -3,7 +3,7 @@
/* tslint:disable */
/* eslint-disable */
export type CreateGoalDTO = {
goalName?: string;
name?: string;
description?: string;
targetAmount?: number;
targetDate?: string;
......
......@@ -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;
};
......@@ -2,15 +2,10 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ParticipantUserDTO } from './ParticipantUserDTO';
export type ParticipantDTO = {
role?: ParticipantDTO.role;
user?: ParticipantUserDTO;
export type FeedbackResponseDTO = {
id?: string;
email?: string;
message?: string;
createdAt?: string;
};
export namespace ParticipantDTO {
export enum role {
CREATOR = 'CREATOR',
CONTRIBUTOR = 'CONTRIBUTOR',
}
}
......@@ -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;
};
......@@ -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;
};
/* 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;
};
......@@ -10,5 +10,6 @@ export type UserDTO = {
email?: string;
createdAt?: string;
role?: string;
subscriptionLevel?: string;
};
......@@ -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,
},
});
}
}
/* 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',
});
}
}
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment