From d927c4a22f0cf7d52efb1eed1c899efc1a677e73 Mon Sep 17 00:00:00 2001 From: henridb <henridb@stud.ntnu.no> Date: Wed, 24 Apr 2024 15:54:44 +0200 Subject: [PATCH] feat: update user config and add bank --- src/api/index.ts | 18 +++++ src/api/models/Account.ts | 11 +++ src/api/models/AccountRequestDTO.ts | 8 ++ src/api/models/AccountResponseDTO.ts | 9 +++ src/api/models/BankProfile.ts | 11 +++ src/api/models/BankProfileDTO.ts | 8 ++ src/api/models/BankProfileResponseDTO.ts | 10 +++ src/api/models/ChallengeDTO.ts | 14 ++++ src/api/models/ConfigurationDTO.ts | 10 +++ src/api/models/CreateGoalDTO.ts | 11 +++ src/api/models/DailyChallengeProgressDTO.ts | 10 +++ src/api/models/GoalDTO.ts | 18 +++++ src/api/models/ParticipantDTO.ts | 16 ++++ src/api/models/ParticipantUserDTO.ts | 9 +++ src/api/models/PasswordResetDTO.ts | 9 +++ src/api/models/SignUpRequest.ts | 5 +- src/api/models/TransactionDTO.ts | 10 +++ src/api/models/UserUpdateDTO.ts | 5 +- src/api/services/AccountControllerService.ts | 77 +++++++++++++++++++ .../services/BankProfileControllerService.ts | 32 ++++++++ src/api/services/GoalService.ts | 47 +++++++++++ .../services/TransactionControllerService.ts | 31 ++++++++ 22 files changed, 373 insertions(+), 6 deletions(-) create mode 100644 src/api/models/Account.ts create mode 100644 src/api/models/AccountRequestDTO.ts create mode 100644 src/api/models/AccountResponseDTO.ts create mode 100644 src/api/models/BankProfile.ts create mode 100644 src/api/models/BankProfileDTO.ts create mode 100644 src/api/models/BankProfileResponseDTO.ts create mode 100644 src/api/models/ChallengeDTO.ts create mode 100644 src/api/models/ConfigurationDTO.ts create mode 100644 src/api/models/CreateGoalDTO.ts create mode 100644 src/api/models/DailyChallengeProgressDTO.ts create mode 100644 src/api/models/GoalDTO.ts create mode 100644 src/api/models/ParticipantDTO.ts create mode 100644 src/api/models/ParticipantUserDTO.ts create mode 100644 src/api/models/PasswordResetDTO.ts create mode 100644 src/api/models/TransactionDTO.ts create mode 100644 src/api/services/AccountControllerService.ts create mode 100644 src/api/services/BankProfileControllerService.ts create mode 100644 src/api/services/GoalService.ts create mode 100644 src/api/services/TransactionControllerService.ts diff --git a/src/api/index.ts b/src/api/index.ts index 952a64c..b638586 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -7,17 +7,35 @@ export { CancelablePromise, CancelError } from './core/CancelablePromise'; export { OpenAPI } from './core/OpenAPI'; export type { OpenAPIConfig } from './core/OpenAPI'; +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 { BankProfile } from './models/BankProfile'; +export type { BankProfileDTO } from './models/BankProfileDTO'; +export type { BankProfileResponseDTO } from './models/BankProfileResponseDTO'; +export type { ChallengeDTO } from './models/ChallengeDTO'; +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 { GoalDTO } from './models/GoalDTO'; export type { LeaderboardDTO } from './models/LeaderboardDTO'; export type { LeaderboardEntryDTO } from './models/LeaderboardEntryDTO'; export type { LoginRequest } from './models/LoginRequest'; +export { ParticipantDTO } from './models/ParticipantDTO'; +export type { ParticipantUserDTO } from './models/ParticipantUserDTO'; export type { PasswordResetDTO } from './models/PasswordResetDTO'; export type { ProfileDTO } from './models/ProfileDTO'; export type { SignUpRequest } from './models/SignUpRequest'; +export type { TransactionDTO } from './models/TransactionDTO'; export type { UserDTO } from './models/UserDTO'; export type { UserUpdateDTO } from './models/UserUpdateDTO'; +export { AccountControllerService } from './services/AccountControllerService'; export { AuthenticationService } from './services/AuthenticationService'; +export { BankProfileControllerService } from './services/BankProfileControllerService'; +export { GoalService } from './services/GoalService'; export { LeaderboardService } from './services/LeaderboardService'; +export { TransactionControllerService } from './services/TransactionControllerService'; export { UserService } from './services/UserService'; diff --git a/src/api/models/Account.ts b/src/api/models/Account.ts new file mode 100644 index 0000000..fb3a632 --- /dev/null +++ b/src/api/models/Account.ts @@ -0,0 +1,11 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { BankProfile } from './BankProfile'; +export type Account = { + bban?: number; + balance?: number; + bankProfile?: BankProfile; +}; + diff --git a/src/api/models/AccountRequestDTO.ts b/src/api/models/AccountRequestDTO.ts new file mode 100644 index 0000000..c2f7ddd --- /dev/null +++ b/src/api/models/AccountRequestDTO.ts @@ -0,0 +1,8 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type AccountRequestDTO = { + ssn?: number; +}; + diff --git a/src/api/models/AccountResponseDTO.ts b/src/api/models/AccountResponseDTO.ts new file mode 100644 index 0000000..276a213 --- /dev/null +++ b/src/api/models/AccountResponseDTO.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type AccountResponseDTO = { + bankProfileId?: number; + balance?: number; +}; + diff --git a/src/api/models/BankProfile.ts b/src/api/models/BankProfile.ts new file mode 100644 index 0000000..b4fe99e --- /dev/null +++ b/src/api/models/BankProfile.ts @@ -0,0 +1,11 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Account } from './Account'; +export type BankProfile = { + id?: number; + ssn?: number; + accounts?: Array<Account>; +}; + diff --git a/src/api/models/BankProfileDTO.ts b/src/api/models/BankProfileDTO.ts new file mode 100644 index 0000000..e6b1b89 --- /dev/null +++ b/src/api/models/BankProfileDTO.ts @@ -0,0 +1,8 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type BankProfileDTO = { + ssn?: number; +}; + diff --git a/src/api/models/BankProfileResponseDTO.ts b/src/api/models/BankProfileResponseDTO.ts new file mode 100644 index 0000000..3ef2360 --- /dev/null +++ b/src/api/models/BankProfileResponseDTO.ts @@ -0,0 +1,10 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Account } from './Account'; +export type BankProfileResponseDTO = { + ssn?: number; + accounts?: Array<Account>; +}; + diff --git a/src/api/models/ChallengeDTO.ts b/src/api/models/ChallengeDTO.ts new file mode 100644 index 0000000..f5bd38d --- /dev/null +++ b/src/api/models/ChallengeDTO.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { DailyChallengeProgressDTO } from './DailyChallengeProgressDTO'; +export type ChallengeDTO = { + id?: number; + potentialSavingAmount?: number; + points?: number; + days?: number; + createdAt?: string; + dailyChallengeProgressList?: Array<DailyChallengeProgressDTO>; +}; + diff --git a/src/api/models/ConfigurationDTO.ts b/src/api/models/ConfigurationDTO.ts new file mode 100644 index 0000000..4d4b452 --- /dev/null +++ b/src/api/models/ConfigurationDTO.ts @@ -0,0 +1,10 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ConfigurationDTO = { + commitment?: string; + experience?: string; + challengeTypes?: Array<string>; +}; + diff --git a/src/api/models/CreateGoalDTO.ts b/src/api/models/CreateGoalDTO.ts new file mode 100644 index 0000000..61eb045 --- /dev/null +++ b/src/api/models/CreateGoalDTO.ts @@ -0,0 +1,11 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type CreateGoalDTO = { + goalName?: string; + description?: string; + targetAmount?: number; + targetDate?: string; +}; + diff --git a/src/api/models/DailyChallengeProgressDTO.ts b/src/api/models/DailyChallengeProgressDTO.ts new file mode 100644 index 0000000..c7bda73 --- /dev/null +++ b/src/api/models/DailyChallengeProgressDTO.ts @@ -0,0 +1,10 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type DailyChallengeProgressDTO = { + id?: number; + challengeDay?: number; + completedAt?: string; +}; + diff --git a/src/api/models/GoalDTO.ts b/src/api/models/GoalDTO.ts new file mode 100644 index 0000000..004eb49 --- /dev/null +++ b/src/api/models/GoalDTO.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ChallengeDTO } from './ChallengeDTO'; +import type { ParticipantDTO } from './ParticipantDTO'; +export type GoalDTO = { + id?: number; + goalName?: string; + description?: string; + targetAmount?: number; + targetDate?: string; + completedAt?: string; + createdAt?: string; + challenges?: Array<ChallengeDTO>; + participants?: Array<ParticipantDTO>; +}; + diff --git a/src/api/models/ParticipantDTO.ts b/src/api/models/ParticipantDTO.ts new file mode 100644 index 0000000..0615b50 --- /dev/null +++ b/src/api/models/ParticipantDTO.ts @@ -0,0 +1,16 @@ +/* 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/ParticipantUserDTO.ts b/src/api/models/ParticipantUserDTO.ts new file mode 100644 index 0000000..5499c09 --- /dev/null +++ b/src/api/models/ParticipantUserDTO.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ParticipantUserDTO = { + firstName?: string; + lastName?: string; +}; + diff --git a/src/api/models/PasswordResetDTO.ts b/src/api/models/PasswordResetDTO.ts new file mode 100644 index 0000000..383b7ad --- /dev/null +++ b/src/api/models/PasswordResetDTO.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type PasswordResetDTO = { + token: string; + password?: string; +}; + diff --git a/src/api/models/SignUpRequest.ts b/src/api/models/SignUpRequest.ts index f9aa1f6..72720c4 100644 --- a/src/api/models/SignUpRequest.ts +++ b/src/api/models/SignUpRequest.ts @@ -2,13 +2,12 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ +import type { ConfigurationDTO } from './ConfigurationDTO'; export type SignUpRequest = { firstName?: string; lastName?: string; email?: string; password?: string; - commitment?: string; - experience?: string; - challengeTypes?: Array<string>; + configuration: ConfigurationDTO; }; diff --git a/src/api/models/TransactionDTO.ts b/src/api/models/TransactionDTO.ts new file mode 100644 index 0000000..d974cb5 --- /dev/null +++ b/src/api/models/TransactionDTO.ts @@ -0,0 +1,10 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type TransactionDTO = { + debtorBBAN?: number; + creditorBBAN?: number; + amount?: number; +}; + diff --git a/src/api/models/UserUpdateDTO.ts b/src/api/models/UserUpdateDTO.ts index 54cc0f5..00b3b0a 100644 --- a/src/api/models/UserUpdateDTO.ts +++ b/src/api/models/UserUpdateDTO.ts @@ -2,13 +2,12 @@ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ +import type { ConfigurationDTO } from './ConfigurationDTO'; export type UserUpdateDTO = { firstName?: string; lastName?: string; email?: string; password?: string; - commitment?: string; - experience?: string; - challengeTypes?: Array<string>; + configuration?: ConfigurationDTO; }; diff --git a/src/api/services/AccountControllerService.ts b/src/api/services/AccountControllerService.ts new file mode 100644 index 0000000..181460c --- /dev/null +++ b/src/api/services/AccountControllerService.ts @@ -0,0 +1,77 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Account } from '../models/Account'; +import type { AccountRequestDTO } from '../models/AccountRequestDTO'; +import type { AccountResponseDTO } from '../models/AccountResponseDTO'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class AccountControllerService { + /** + * Create account + * Create account with random balance + * @returns AccountResponseDTO Successfully created account + * @throws ApiError + */ + public static createAccount({ + requestBody, + }: { + requestBody: AccountRequestDTO, + }): CancelablePromise<AccountResponseDTO> { + return __request(OpenAPI, { + method: 'POST', + url: '/bank/v1/account/create-account', + body: requestBody, + mediaType: 'application/json', + errors: { + 404: `Provided bank profile id could not be found`, + }, + }); + } + /** + * Get user accounts + * Get accounts associated with a user by providing their social security number + * @returns Account No accounts associated with a bank user + * @throws ApiError + */ + public static getAccountsBySsn({ + ssn, + }: { + ssn: number, + }): CancelablePromise<Array<Account>> { + return __request(OpenAPI, { + method: 'GET', + url: '/bank/v1/account/accounts/ssn/{ssn}', + path: { + 'ssn': ssn, + }, + errors: { + 404: `Social security number does not exist`, + }, + }); + } + /** + * Get user accounts + * Get accounts associated with a user by providing their bank profile id + * @returns Account No accounts associated with a bank user + * @throws ApiError + */ + public static getAccounts({ + bankProfileId, + }: { + bankProfileId: number, + }): CancelablePromise<Array<Account>> { + return __request(OpenAPI, { + method: 'GET', + url: '/bank/v1/account/accounts/profile/{bankProfileId}', + path: { + 'bankProfileId': bankProfileId, + }, + errors: { + 404: `Bank profile id does not exist`, + }, + }); + } +} diff --git a/src/api/services/BankProfileControllerService.ts b/src/api/services/BankProfileControllerService.ts new file mode 100644 index 0000000..5ae9fa3 --- /dev/null +++ b/src/api/services/BankProfileControllerService.ts @@ -0,0 +1,32 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { BankProfileDTO } from '../models/BankProfileDTO'; +import type { BankProfileResponseDTO } from '../models/BankProfileResponseDTO'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class BankProfileControllerService { + /** + * Create bank profile + * Create a bank profile by providing a social security number + * @returns BankProfileResponseDTO Successfully created a bank profile + * @throws ApiError + */ + public static createBankProfile({ + requestBody, + }: { + requestBody: BankProfileDTO, + }): CancelablePromise<BankProfileResponseDTO> { + return __request(OpenAPI, { + method: 'POST', + url: '/bank/v1/profile/create-profile', + body: requestBody, + mediaType: 'application/json', + errors: { + 400: `Could not create profile`, + }, + }); + } +} diff --git a/src/api/services/GoalService.ts b/src/api/services/GoalService.ts new file mode 100644 index 0000000..28ae857 --- /dev/null +++ b/src/api/services/GoalService.ts @@ -0,0 +1,47 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { CreateGoalDTO } from '../models/CreateGoalDTO'; +import type { GoalDTO } from '../models/GoalDTO'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class GoalService { + /** + * @returns GoalDTO OK + * @throws ApiError + */ + public static createGoal({ + requestBody, + }: { + requestBody: CreateGoalDTO, + }): CancelablePromise<GoalDTO> { + return __request(OpenAPI, { + method: 'POST', + url: '/api/goal/createGoal', + body: requestBody, + mediaType: 'application/json', + }); + } + /** + * @returns GoalDTO OK + * @throws ApiError + */ + public static getGoals(): CancelablePromise<Array<GoalDTO>> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/goal/getGoals', + }); + } + /** + * @returns GoalDTO OK + * @throws ApiError + */ + public static getGoal(): CancelablePromise<GoalDTO> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/goal/getGoal', + }); + } +} diff --git a/src/api/services/TransactionControllerService.ts b/src/api/services/TransactionControllerService.ts new file mode 100644 index 0000000..f584d0a --- /dev/null +++ b/src/api/services/TransactionControllerService.ts @@ -0,0 +1,31 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { TransactionDTO } from '../models/TransactionDTO'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class TransactionControllerService { + /** + * Transfer to account + * Transfer money from a users account to another account of the same user + * @returns TransactionDTO No accounts associated with a bank user + * @throws ApiError + */ + public static transferToSelf({ + requestBody, + }: { + requestBody: TransactionDTO, + }): CancelablePromise<TransactionDTO> { + return __request(OpenAPI, { + method: 'POST', + url: '/bank/v1/transaction/norwegian-domestic-payment-to-self', + body: requestBody, + mediaType: 'application/json', + errors: { + 404: `Bank profile id does not exist`, + }, + }); + } +} -- GitLab