Skip to content

Commit

Permalink
Migrated:
Browse files Browse the repository at this point in the history
all responses,
balance-controller.ts
and some entities
  • Loading branch information
JustSamuel committed Dec 25, 2023
1 parent 68fd020 commit 2fd09c1
Show file tree
Hide file tree
Showing 27 changed files with 219 additions and 213 deletions.
50 changes: 25 additions & 25 deletions src/controller/balance-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export default class BalanceController extends BaseController {
}

/**
* @inheritdoc
*/
* @inheritdoc
*/
public getPolicy(): Policy {
return {
'/': {
Expand All @@ -66,15 +66,15 @@ export default class BalanceController extends BaseController {
}

/**
* Get balance of the current user
* @route get /balances
* GET /balances
* @summary Get balance of the current user
* @operationId getBalances
* @group balance - Operations of balance controller
* @tags balance - Operations of balance controller
* @security JWT
* @returns {BalanceResponse.model} 200 - The requested user's balance
* @returns {string} 400 - Validation error
* @returns {string} 404 - Not found error
* @returns {string} 500 - Internal server error
* @return {BalanceResponse} 200 - The requested user's balance
* @return {string} 400 - Validation error
* @return {string} 404 - Not found error
* @return {string} 500 - Internal server error
*/
// eslint-disable-next-line class-methods-use-this
private async getOwnBalance(req: RequestWithToken, res: Response): Promise<void> {
Expand All @@ -87,25 +87,25 @@ export default class BalanceController extends BaseController {
}

/**
* Get balance of the current user
* @route GET /balances/all
* GET /balances/all
* @summary Get balance of the current user
* @operationId getAllBalance
* @group balance - Operations of balance controller
* @tags balance - Operations of balance controller
* @security JWT
* @param {string} date.query - Timestamp to get balances for
* @param {integer} minBalance.query - Minimum balance
* @param {integer} maxBalance.query - Maximum balance
* @param {boolean} hasFine.query - Only users with(out) fines
* @param {integer} minFine.query - Minimum fine
* @param {integer} maxFine.query - Maximum fine
* @param {string} userType[].query.enum{MEMBER,ORGAN,VOUCHER,LOCAL_USER,LOCAL_ADMIN,INVOICE,AUTOMATIC_INVOICE} - Filter based on user type.
* @param {enum} orderBy.query - Column to order balance by - eg: id,amount
* @param {enum} orderDirection.query - Order direction - eg: ASC,DESC
* @param {string} userType.query - enum:MEMBER,ORGAN,VOUCHER,LOCAL_USER,LOCAL_ADMIN,INVOICE,AUTOMATIC_INVOICE - Filter based on user type.
* @param {string} orderBy.query - Column to order balance by - eg: id,amount
* @param {string} orderDirection.query - enum:ASC,DESC - Order direction
* @param {integer} take.query - How many transactions the endpoint should return
* @param {integer} skip.query - How many transactions should be skipped (for pagination)
* @returns {Array<BalanceResponse>} 200 - The requested user's balance
* @returns {string} 400 - Validation error
* @returns {string} 500 - Internal server error
* @return {Array<BalanceResponse>} 200 - The requested user's balance
* @return {string} 400 - Validation error
* @return {string} 500 - Internal server error
*/
private async getAllBalances(req: RequestWithToken, res: Response): Promise<void> {
this.logger.trace('Get all balances by', req.token.user);
Expand Down Expand Up @@ -143,16 +143,16 @@ export default class BalanceController extends BaseController {
}

/**
* Retrieves the requested balance
* @route get /balances/{id}
* GET /balances/{id}
* @summary Retrieves the requested balance
* @operationId getBalanceId
* @group balance - Operations of balance controller
* @tags balance - Operations of balance controller
* @param {integer} id.path.required - The id of the user for which the saldo is requested
* @security JWT
* @returns {BalanceResponse.model} 200 - The requested user's balance
* @returns {string} 400 - Validation error
* @returns {string} 404 - Not found error
* @returns {string} 500 - Internal server error
* @return {BalanceResponse} 200 - The requested user's balance
* @return {string} 400 - Validation error
* @return {string} 404 - Not found error
* @return {string} 500 - Internal server error
*/
private async getBalance(req: RequestWithToken, res: Response): Promise<void> {
try {
Expand Down
4 changes: 2 additions & 2 deletions src/controller/request/dinero-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
*/

/**
* @typedef DineroObject
* @typedef {object} DineroObject
* @property {integer} amount.required - amount
* @property {string} currency.required - currency
* @property {integer} precision.required - precision
*/

/**
* @typedef DineroObjectRequest
* @typedef {object} DineroObjectRequest
* @property {integer} amount.required - amount
* @property {string} currency.required - currency
* @property {integer} precision.required - precision
Expand Down
10 changes: 5 additions & 5 deletions src/controller/response/balance-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import { DineroObjectResponse } from './dinero-response';
import { PaginationResult } from '../../helpers/pagination';

/**
* @typedef BalanceResponse
* @typedef {object} BalanceResponse
* @property {number} id.required - ID of the user this balance belongs to
* @property {string} date.required - Date at which this user had this balance
* @property {DineroObjectResponse.model} amount.required - The amount of balance this user has
* @property {DineroObjectResponse.model} fine - The amount of fines this user has at the current point in time,
* @property {DineroObjectResponse} amount.required - The amount of balance this user has
* @property {DineroObjectResponse} fine - The amount of fines this user has at the current point in time,
* aka "now" (if any). Should be ignored if date is not now.
* @property {string} fineSince - Timestamp of the first fine
* @property {number} lastTransactionId - The ID of the last transaction that was
Expand All @@ -42,8 +42,8 @@ export default interface BalanceResponse {
}

/**
* @typedef PaginatedBalanceResponse
* @property {PaginationResult.model} _pagination - Pagination metadata
* @typedef {object} PaginatedBalanceResponse
* @property {PaginationResult} _pagination - Pagination metadata
* @property {Array<BalanceResponse>} records - Returned balance responses
*/
export interface PaginatedBalanceResponse {
Expand Down
22 changes: 11 additions & 11 deletions src/controller/response/container-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { BaseUserResponse } from './user-response';
import { PaginationResult } from '../../helpers/pagination';

/**
* @typedef {BaseResponse} BaseContainerResponse
* @typedef {allOf|BaseResponse} BaseContainerResponse
* @property {string} name.required - The name of the container.
* @property {boolean} public.required - Public status of the container.
* @property {integer} revision - The container revision.
Expand All @@ -33,36 +33,36 @@ export interface BaseContainerResponse extends BaseResponse {
}

/**
* @typedef {BaseContainerResponse} ContainerResponse
* @property {BaseUserResponse.model} owner.required - The owner of the container.
* @typedef {allOf|BaseContainerResponse} ContainerResponse
* @property {BaseUserResponse} owner.required - The owner of the container.
*/
export interface ContainerResponse extends BaseContainerResponse {
owner: BaseUserResponse,
}

/**
* @typedef PaginatedContainerResponse
* @property {PaginationResult.model} _pagination.required - Pagination metadata
* @property {Array.<ContainerResponse>} records.required - Returned containers
* @typedef {object} PaginatedContainerResponse
* @property {PaginationResult} _pagination.required - Pagination metadata
* @property {Array<ContainerResponse>} records.required - Returned containers
*/
export interface PaginatedContainerResponse {
_pagination: PaginationResult,
records: ContainerResponse[],
}

/**
* @typedef PaginatedContainerWithProductResponse
* @property {PaginationResult.model} _pagination.required - Pagination metadata
* @property {Array.<ContainerWithProductsResponse>} records.required - Returned containers
* @typedef {object} PaginatedContainerWithProductResponse
* @property {PaginationResult} _pagination.required - Pagination metadata
* @property {Array<ContainerWithProductsResponse>} records.required - Returned containers
*/
export interface PaginatedContainerWithProductResponse {
_pagination: PaginationResult,
records: ContainerWithProductsResponse[],
}

/**
* @typedef {ContainerResponse} ContainerWithProductsResponse
* @property {Array.<ProductResponse>} products.required - The products in the container.
* @typedef {allOf|ContainerResponse} ContainerWithProductsResponse
* @property {Array<ProductResponse>} products.required - The products in the container.
*/
export interface ContainerWithProductsResponse extends ContainerResponse {
products: ProductResponse[],
Expand Down
30 changes: 15 additions & 15 deletions src/controller/response/debtor-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import { BaseUserResponse } from './user-response';
import BalanceResponse from './balance-response';

/**
* @typedef UserToFineResponse
* @typedef {object} UserToFineResponse
* @property {integer} id.required - User ID
* @property {DineroObjectResponse.model} fineAmount.required - Amount to fine
* @property {Array.<BalanceResponse>} balances.required - Balances at the given reference dates
* @property {DineroObjectResponse} fineAmount.required - Amount to fine
* @property {Array<BalanceResponse>} balances.required - Balances at the given reference dates
*/
export interface UserToFineResponse {
id: number;
Expand All @@ -34,46 +34,46 @@ export interface UserToFineResponse {
}

/**
* @typedef {BaseResponse} FineResponse
* @property {DineroObjectResponse.model} amount.required - Fine amount
* @property {BaseUserResponse.model} user.required - User that got the fine
* @typedef {allOf|BaseResponse} FineResponse
* @property {DineroObjectResponse} amount.required - Fine amount
* @property {BaseUserResponse} user.required - User that got the fine
*/
export interface FineResponse extends BaseResponse {
amount: DineroObjectResponse;
user: BaseUserResponse;
}

/**
* @typedef {BaseResponse} BaseFineHandoutEventResponse
* @typedef {allOf|BaseResponse} BaseFineHandoutEventResponse
* @property {string} referenceDate.required - Reference date of fines
* @property {BaseUserResponse.model} createdBy.required - User that handed out the fines
* @property {BaseUserResponse} createdBy.required - User that handed out the fines
*/
export interface BaseFineHandoutEventResponse extends BaseResponse {
referenceDate: string;
createdBy: BaseUserResponse;
}

/**
* @typedef {BaseFineHandoutEventResponse} FineHandoutEventResponse
* @property {Array.<FineResponse>} fines.required - Fines that have been handed out
* @typedef {allOf|BaseFineHandoutEventResponse} FineHandoutEventResponse
* @property {Array<FineResponse>} fines.required - Fines that have been handed out
*/
export interface FineHandoutEventResponse extends BaseFineHandoutEventResponse {
fines: FineResponse[];
}

/**
* @typedef PaginatedFineHandoutEventResponse
* @property {PaginationResult.model} _pagination.required - Pagination metadata
* @property {Array.<BaseFineHandoutEventResponse>} records.required - Returned fine handout events
* @typedef {object} PaginatedFineHandoutEventResponse
* @property {PaginationResult} _pagination.required - Pagination metadata
* @property {Array<BaseFineHandoutEventResponse>} records.required - Returned fine handout events
*/
export interface PaginatedFineHandoutEventResponse {
_pagination: PaginationResult,
records: BaseFineHandoutEventResponse[],
}

/**
* @typedef UserFineGroupResponse
* @property {Array.<FineResponse>} fines.required - Fines that have been handed out
* @typedef {object} UserFineGroupResponse
* @property {Array<FineResponse>} fines.required - Fines that have been handed out
*/
export interface UserFineGroupResponse {
fines: FineResponse[];
Expand Down
2 changes: 1 addition & 1 deletion src/controller/response/dinero-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

/**
* @typedef DineroObjectResponse
* @typedef {object} DineroObjectResponse
* @property {integer} amount.required - amount
* @property {string} currency.required - currency
* @property {integer} precision.required - precision
Expand Down
2 changes: 1 addition & 1 deletion src/controller/response/dinero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

/**
* @typedef Dinero
* @typedef {object} Dinero
* @property {integer} amount.required - The amount of money as integer in the given precision.
* @property {integer} precision.required - The precision of the amount, in decimal places.
* @property {string} currency.required - The ISO 4217 currency code.
Expand Down
26 changes: 13 additions & 13 deletions src/controller/response/event-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import { BaseUserResponse } from './user-response';
import { EventType } from '../../entity/event/event';

/**
* @typedef {BaseResponse} BaseEventResponse
* @typedef {allOf|BaseResponse} BaseEventResponse
* @property {string} name.required - Name of the borrel.
* @property {BaseUserResponse.model} createdBy.required - Creator of the event.
* @property {BaseUserResponse} createdBy.required - Creator of the event.
* @property {string} startDate.required - The starting date of the event.
* @property {string} endDate.required - The end date of the event.
* @property {string} type.required - The tpye of event.
Expand All @@ -37,32 +37,32 @@ export interface BaseEventResponse extends BaseResponse {
}

/**
* @typedef {BaseResponse} BaseEventShiftResponse
* @typedef {allOf|BaseResponse} BaseEventShiftResponse
* @property {string} name.required - Name of the shift.
*/
export interface BaseEventShiftResponse extends BaseResponse {
name: string,
}

/**
* @typedef {BaseEventShiftResponse} EventShiftResponse
* @typedef {allOf|BaseEventShiftResponse} EventShiftResponse
* @property {Array<string>} roles.required - Which roles can fill in this shift.
*/
export interface EventShiftResponse extends BaseEventShiftResponse {
roles: string[],
}

/**
* @typedef {EventShiftResponse} EventInShiftResponse
* @typedef {allOf|EventShiftResponse} EventInShiftResponse
* @property {Array<BaseEventAnswerResponse>} answers - Answers for this shift.
*/
export interface EventInShiftResponse extends EventShiftResponse {
answers: BaseEventAnswerResponse[];
}

/**
* @typedef PaginatedEventShiftResponse
* @property {PaginationResult.model} _pagination.required - Pagination metadata
* @typedef {object} PaginatedEventShiftResponse
* @property {PaginationResult} _pagination.required - Pagination metadata
* @property {Array<EventShiftResponse>} records.required - Returned event shifts
*/
export interface PaginatedEventShiftResponse {
Expand All @@ -71,16 +71,16 @@ export interface PaginatedEventShiftResponse {
}

/**
* @typedef {BaseEventResponse} EventResponse
* @typedef {allOf|BaseEventResponse} EventResponse
* @property {Array<EventInShiftResponse>} shifts.required - Shifts for this event
*/
export interface EventResponse extends BaseEventResponse {
shifts: EventInShiftResponse[],
}

/**
* @typedef BaseEventAnswerResponse
* @property {BaseUserResponse.model} user.required - Participant that filled in their availability
* @typedef {object} BaseEventAnswerResponse
* @property {BaseUserResponse} user.required - Participant that filled in their availability
* @property {string} availability - Filled in availability per slot.
* @property {boolean} selected.required - Whether this user is selected for the shift in the event
*/
Expand All @@ -91,8 +91,8 @@ export interface BaseEventAnswerResponse {
}

/**
* @typedef PaginatedBaseEventResponse
* @property {PaginationResult.model} _pagination.required - Pagination metadata
* @typedef {object} PaginatedBaseEventResponse
* @property {PaginationResult} _pagination.required - Pagination metadata
* @property {Array<BaseEventResponse>} records.required - Returned borrel Schemas
*/
export interface PaginatedBaseEventResponse {
Expand All @@ -101,7 +101,7 @@ export interface PaginatedBaseEventResponse {
}

/**
* @typedef {BaseUserResponse} EventPlanningSelectedCount
* @typedef {allOf|BaseUserResponse} EventPlanningSelectedCount
* @property {integer} count.required - Number of times this user was selected for this shift
*/
export interface EventPlanningSelectedCount extends BaseUserResponse {
Expand Down
12 changes: 6 additions & 6 deletions src/controller/response/financial-mutation-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ import { TransferResponse } from './transfer-response';
import { BaseTransactionResponse } from './transaction-response';

/**
* @typedef FinancialMutationResponse
* @property {string} type.required - Type of mutation ('transfer' or 'transaction') (Optional)
* @property {object} mutation - Details of mutation, this can be either of type TransferResponse or BaseTransactionResponse
* @typedef {object} FinancialMutationResponse
* @property {string} type.required - enum:transfer,transaction - Type of mutation ('transfer' or 'transaction') (Optional)
* @property {oneOf|TransferResponse|BaseTransactionResponse} mutation - Details of mutation, this can be either of type TransferResponse or BaseTransactionResponse
*/
export interface FinancialMutationResponse {
type: 'transfer' | 'transaction',
mutation: TransferResponse | BaseTransactionResponse,
}

/**
* @typedef PaginatedFinancialMutationResponse
* @property {PaginationResult.model} _pagination.required - Pagination metadata
* @property {Array.<FinancialMutationResponse>} records.required - Returned mutations
* @typedef {object} PaginatedFinancialMutationResponse
* @property {PaginationResult} _pagination.required - Pagination metadata
* @property {Array<FinancialMutationResponse>} records.required - Returned mutations
*/
export interface PaginatedFinancialMutationResponse {
_pagination: PaginationResult,
Expand Down
Loading

0 comments on commit 2fd09c1

Please sign in to comment.