Skip to content

Commit

Permalink
feat: Move /users response interface to shared-types
Browse files Browse the repository at this point in the history
  • Loading branch information
letehaha committed Jul 6, 2023
1 parent d62d866 commit f170374
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions shared-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ export enum CATEGORY_TYPES {
}

export * from './error-codes';
export * from './response';
11 changes: 11 additions & 0 deletions shared-types/response/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export interface UserModel {
id: number;
username: string;
email: string;
firstName: string;
lastName: string;
middleName: string;
avatar: string;
totalBalance: number;
defaultCategoryId: number;
}
4 changes: 2 additions & 2 deletions src/controllers/users.controller.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ERROR_CODES } from 'shared-types';
import { ERROR_CODES, UserModel } from 'shared-types';
import { CustomResponse, RESPONSE_STATUS } from '@common/types';

import { getUsers as getUsersModel } from '../models/Users.model';

export const getUsers = async (req, res: CustomResponse) => {
try {
const users = await getUsersModel();
const users: UserModel[] = await getUsersModel();

return res.status(200).json({
status: RESPONSE_STATUS.success,
Expand Down

0 comments on commit f170374

Please sign in to comment.