Skip to content
Snippets Groups Projects
Commit cf5e2930 authored by Anders Høvik's avatar Anders Høvik
Browse files

Merge branch 'main' into feature/history-endpoint

parents a4bd8099 815b3603
No related branches found
No related tags found
1 merge request!86Feature/history endpoint
Showing
with 599 additions and 459 deletions
......@@ -3,6 +3,8 @@ import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
specPattern: 'cypress/e2e/**/*.{cy,spec}.{js,jsx,ts,tsx}',
baseUrl: 'http://localhost:5173'
baseUrl: 'http://localhost:5173',
viewportHeight: 1080,
viewportWidth: 1920,
}
})
describe('BasePage test', () => {
beforeEach(() => {
cy.visit('/login');
cy.get('#emailInput input').type('user@example.com');
cy.get('#passwordInput input').type('John1');
cy.get('form').submit();
cy.wait(1000);
cy.visit('/')
});
it('uses menu to visit leaderboard', () => {
cy.get('[data-cy="menu"]').get('[data-cy="leaderboard"]').click();
cy.url().should('include', '/leaderboard');
});
it('uses menu to visit news', () => {
cy.get('[data-cy="menu"]').get('[data-cy="news"]').click();
cy.url().should('include', '/news');
});
it('uses menu to visit store', () => {
cy.get('[data-cy="menu"]').get('[data-cy="store"]').click();
cy.url().should('include', '/shop');
});
it('uses menu to visit roadmap', () => {
cy.get('[data-cy="menu"]').get('[data-cy="savingGoals"]').click();
cy.url().should('include', '/roadmap');
});
it('uses menu to visit user profile', () => {
cy.get('[data-cy="menu"]').get('[data-cy="user"]').click();
cy.get('[data-cy="profile"]').click();
cy.url().should('include', '/profile');
});
it('uses menu to visit budget', () => {
cy.get('[data-cy="menu"]').get('[data-cy="user"]').click();
cy.get('[data-cy="budget"]').click();
cy.url().should('include', '/budget');
});
it('uses menu to visit friends', () => {
cy.get('[data-cy="menu"]').get('[data-cy="user"]').click();
cy.get('[data-cy="friends"]').click();
cy.url().should('include', '/friends');
});
it('uses menu to visit settings', () => {
cy.get('[data-cy="menu"]').get('[data-cy="user"]').click();
cy.get('[data-cy="settings"]').click();
cy.url().should('include', '/settings');
});
it('uses menu to visit feedback', () => {
cy.get('[data-cy="menu"]').get('[data-cy="user"]').click();
cy.get('[data-cy="feedback"]').click();
cy.url().should('include', '/feedback');
});
it('uses menu to log out', () => {
cy.get('[data-cy="menu"]').get('[data-cy="user"]').click();
cy.get('[data-testid="logout"]').click();
cy.wait(1000);
cy.url().should('include', '/login');
});
})
\ No newline at end of file
This diff is collapsed.
......@@ -11,26 +11,22 @@ export type { Account } from './models/Account';
export type { AccountRequestDTO } from './models/AccountRequestDTO';
export type { AccountResponseDTO } from './models/AccountResponseDTO';
export type { AuthenticationResponse } from './models/AuthenticationResponse';
export type { Badge } from './models/Badge';
export type { BadgeUser } from './models/BadgeUser';
export type { BadgeUserId } from './models/BadgeUserId';
export type { BankAccountDTO } from './models/BankAccountDTO';
export type { BankProfile } from './models/BankProfile';
export type { BankProfileDTO } from './models/BankProfileDTO';
export type { BankProfileResponseDTO } from './models/BankProfileResponseDTO';
export type { Budget } from './models/Budget';
export type { BudgetRequestDTO } from './models/BudgetRequestDTO';
export type { BudgetResponseDTO } from './models/BudgetResponseDTO';
export type { ChallengeDTO } from './models/ChallengeDTO';
export { Configuration } from './models/Configuration';
export type { ConfigurationDTO } from './models/ConfigurationDTO';
export type { CreateGoalDTO } from './models/CreateGoalDTO';
export type { DailyChallengeProgressDTO } from './models/DailyChallengeProgressDTO';
export type { ExceptionResponse } from './models/ExceptionResponse';
export type { ExpenseRequestDTO } from './models/ExpenseRequestDTO';
export type { ExpenseResponseDTO } from './models/ExpenseResponseDTO';
export type { FeedbackRequestDTO } from './models/FeedbackRequestDTO';
export type { FeedbackResponseDTO } from './models/FeedbackResponseDTO';
export type { GoalDTO } from './models/GoalDTO';
export type { GrantedAuthority } from './models/GrantedAuthority';
export type { LeaderboardDTO } from './models/LeaderboardDTO';
export type { LeaderboardEntryDTO } from './models/LeaderboardEntryDTO';
export type { LoginRequest } from './models/LoginRequest';
......@@ -38,12 +34,9 @@ export { ParticipantDTO } from './models/ParticipantDTO';
export type { ParticipantUserDTO } from './models/ParticipantUserDTO';
export type { PasswordResetDTO } from './models/PasswordResetDTO';
export type { PasswordUpdateDTO } from './models/PasswordUpdateDTO';
export type { Point } from './models/Point';
export type { ProfileDTO } from './models/ProfileDTO';
export type { SignUpRequest } from './models/SignUpRequest';
export type { Streak } from './models/Streak';
export type { TransactionDTO } from './models/TransactionDTO';
export { User } from './models/User';
export type { UserDTO } from './models/UserDTO';
export type { UserUpdateDTO } from './models/UserUpdateDTO';
......
......@@ -5,7 +5,10 @@
export type AuthenticationResponse = {
firstName?: string;
lastName?: string;
userId?: number;
profileImage?: number;
role?: string;
subscriptionLevel?: string;
token?: string;
};
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { BadgeUser } from './BadgeUser';
export type Badge = {
id?: number;
badgeName?: string;
criteria?: string;
badgeUserList?: Array<BadgeUser>;
};
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { BadgeUserId } from './BadgeUserId';
export type BadgeUser = {
badgeUserId?: BadgeUserId;
earnedAt?: string;
};
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Badge } from './Badge';
import type { User } from './User';
export type BadgeUserId = {
badge?: Badge;
user?: User;
};
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { User } from './User';
export type Budget = {
id?: number;
user?: User;
createdAt?: string;
budgetName?: string;
budgetAmount?: number;
expenseAmount?: number;
};
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type Configuration = {
id?: number;
commitment?: Configuration.commitment;
experience?: Configuration.experience;
challengeTypes?: Array<'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'>;
};
export namespace Configuration {
export enum commitment {
LITTLE = 'LITTLE',
SOME = 'SOME',
MUCH = 'MUCH',
}
export enum experience {
NONE = 'NONE',
SOME = 'SOME',
EXPERT = 'EXPERT',
}
}
......@@ -2,7 +2,8 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type GrantedAuthority = {
authority?: string;
export type FeedbackRequestDTO = {
email?: string;
message?: string;
};
......@@ -2,9 +2,10 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type Point = {
id?: number;
currentPoints?: number;
totalEarnedPoints?: number;
export type FeedbackResponseDTO = {
id?: string;
email?: string;
message?: string;
createdAt?: string;
};
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type Streak = {
id?: number;
currentStreak?: number;
currentStreakCreatedAt?: string;
currentStreakUpdatedAt?: string;
highestStreak?: number;
highestStreakCreatedAt?: string;
highestStreakEndedAt?: string;
};
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Account } from './Account';
import type { Badge } from './Badge';
import type { Configuration } from './Configuration';
import type { GrantedAuthority } from './GrantedAuthority';
import type { Point } from './Point';
import type { Streak } from './Streak';
export type User = {
id?: number;
firstName?: string;
lastName?: string;
email?: string;
profileImage?: number;
checkingAccount?: Account;
savingsAccount?: Account;
password?: string;
createdAt?: string;
role?: User.role;
badges?: Array<Badge>;
point?: Point;
streak?: Streak;
configuration?: Configuration;
enabled?: boolean;
username?: string;
authorities?: Array<GrantedAuthority>;
accountNonLocked?: boolean;
credentialsNonExpired?: boolean;
accountNonExpired?: boolean;
};
export namespace User {
export enum role {
USER = 'USER',
ADMIN = 'ADMIN',
}
}
......@@ -10,5 +10,6 @@ export type UserDTO = {
email?: string;
createdAt?: string;
role?: string;
subscriptionLevel?: string;
};
......@@ -24,6 +24,31 @@ export class FriendService {
path: {
'friendId': friendId,
},
errors: {
404: `Friend request not found`,
},
});
}
/**
* Delete a friend or cancel a friend request
* Deletes an existing friend from your friend list or cancels a received friend request.
* @returns any Friend successfully deleted or friend request cancelled
* @throws ApiError
*/
public static deleteFriendOrFriendRequest({
friendId,
}: {
friendId: number,
}): CancelablePromise<Record<string, any>> {
return __request(OpenAPI, {
method: 'DELETE',
url: '/api/friends/{friendId}',
path: {
'friendId': friendId,
},
errors: {
404: `Friend or friend request not found`,
},
});
}
/**
......
......@@ -4,11 +4,12 @@
/* eslint-disable */
import type { Account } from '../models/Account';
import type { BankAccountDTO } from '../models/BankAccountDTO';
import type { Budget } from '../models/Budget';
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';
......@@ -18,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
......@@ -112,14 +150,14 @@ export class UserService {
/**
* Create a new budget
* Create a new budget with based on the budget request
* @returns Budget Successfully created new budget
* @returns any Successfully created new budget
* @throws ApiError
*/
public static createBudget({
requestBody,
}: {
requestBody: BudgetRequestDTO,
}): CancelablePromise<Budget> {
}): CancelablePromise<Record<string, any>> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/budget/create',
......@@ -200,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
......@@ -212,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
......
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
<svg fill="white" height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 459.334 459.334" xml:space="preserve" stroke="white">
<g id="SVGRepo_bgCarrier" stroke-width="0"/>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"/>
<g id="SVGRepo_iconCarrier"> <g> <g> <g> <path d="M175.216,404.514c-0.001,0.12-0.009,0.239-0.009,0.359c0,30.078,24.383,54.461,54.461,54.461 s54.461-24.383,54.461-54.461c0-0.12-0.008-0.239-0.009-0.359H175.216z"/> <path d="M403.549,336.438l-49.015-72.002c0-22.041,0-75.898,0-89.83c0-60.581-43.144-111.079-100.381-122.459V24.485 C254.152,10.963,243.19,0,229.667,0s-24.485,10.963-24.485,24.485v27.663c-57.237,11.381-100.381,61.879-100.381,122.459 c0,23.716,0,76.084,0,89.83l-49.015,72.002c-5.163,7.584-5.709,17.401-1.419,25.511c4.29,8.11,12.712,13.182,21.887,13.182 H383.08c9.175,0,17.597-5.073,21.887-13.182C409.258,353.839,408.711,344.022,403.549,336.438z"/> </g> </g> </g> </g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg fill="#000000" height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 459.334 459.334" xml:space="preserve">
<g>
<g>
<g>
<path d="M175.216,404.514c-0.001,0.12-0.009,0.239-0.009,0.359c0,30.078,24.383,54.461,54.461,54.461
s54.461-24.383,54.461-54.461c0-0.12-0.008-0.239-0.009-0.359H175.216z"/>
<path d="M403.549,336.438l-49.015-72.002c0-22.041,0-75.898,0-89.83c0-60.581-43.144-111.079-100.381-122.459V24.485
C254.152,10.963,243.19,0,229.667,0s-24.485,10.963-24.485,24.485v27.663c-57.237,11.381-100.381,61.879-100.381,122.459
c0,23.716,0,76.084,0,89.83l-49.015,72.002c-5.163,7.584-5.709,17.401-1.419,25.511c4.29,8.11,12.712,13.182,21.887,13.182
H383.08c9.175,0,17.597-5.073,21.887-13.182C409.258,353.839,408.711,344.022,403.549,336.438z"/>
</g>
</g>
</g>
</svg>
\ No newline at end of file
src/assets/icons/medal.png

28.1 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment