Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
238051d
feat: enhance login functionality with password visibility toggle and…
vcamarzana Apr 1, 2025
840ce63
Merge branch 'main' into feature/#55-login-build-layout
vcamarzana Apr 1, 2025
22d529f
Merge remote-tracking branch 'origin/main' into feature/#55-login-bui…
vcamarzana May 5, 2025
d79bd04
feat: implement login component with form validation and password vis…
vcamarzana May 12, 2025
f7ce37d
feat: implement authentication flow with JWT, user session management…
vcamarzana May 12, 2025
c6e2aeb
feat: update authentication flow and improve route handling with cook…
manudous May 12, 2025
70d1dad
feat: enhance login functionality with password visibility toggle and…
vcamarzana Apr 1, 2025
5f2db81
feat: implement login component with form validation and password vis…
vcamarzana May 12, 2025
2816b5c
feat: implement authentication flow with JWT, user session management…
vcamarzana May 12, 2025
bac7a54
feat: update authentication flow and improve route handling with cook…
manudous May 12, 2025
dcafe4c
Merge branch 'feature/#55-login-build-layout' of https://github.com/L…
AbelDeTena Jun 5, 2025
b87d606
chore: install cookie-parser in mock server
AbelDeTena Jun 5, 2025
cbf484b
chore: add apellido to whoami response
AbelDeTena Jun 5, 2025
8c1a2a9
feat: display user initials
AbelDeTena Jun 5, 2025
2855aa5
feat: add avatar menu
AbelDeTena Jun 5, 2025
9ee4eff
refactor: extract AvatarMenu from AppBar into separate component
AbelDeTena Jun 5, 2025
522c1fd
feat: add logout
AbelDeTena Jun 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mock-server/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
NODE_ENV=development
PORT=3000
SIMULATED_DELAY=2000
AUTH_SECRET=MY_AUTH_SECRET
181 changes: 176 additions & 5 deletions mock-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion mock-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@
"author": "",
"license": "ISC",
"dependencies": {
"cookie-parser": "^1.4.7",
"express": "^4.21.1",
"jsonwebtoken": "^9.0.2",
"mongodb": "^6.10.0",
"swagger-jsdoc": "^6.2.8",
"swagger-ui-express": "^5.0.1",
"winston": "^3.16.0"
},
"devDependencies": {
"@types/express": "^5.0.0",
"@types/cookie-parser": "^1.4.8",
"@types/express": "^5.0.1",
"@types/jsonwebtoken": "^9.0.9",
"@types/prompts": "^2.4.9",
"@types/swagger-jsdoc": "^6.0.4",
"@types/swagger-ui-express": "^4.1.7",
Expand Down
4 changes: 4 additions & 0 deletions mock-server/src/common/models/credentials.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface UserCredentials {
email: string;
contraseña: string;
}
2 changes: 2 additions & 0 deletions mock-server/src/common/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * from './collection.model.js';
export * from './lookup.model.js';
export * from './credentials.model.js';
export * from './user-session.model.js';
6 changes: 6 additions & 0 deletions mock-server/src/common/models/user-session.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { Lookup } from './lookup.model.js';

export interface UserSession {
id: string;
rol: Lookup;
}
1 change: 1 addition & 0 deletions mock-server/src/core/constants/env.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export const ENV = {
IS_PRODUCTION: process.env.NODE_ENV === 'production',
PORT: Number(process.env.PORT),
SIMULATED_DELAY: +process.env.SIMULATED_DELAY,
AUTH_SECRET: process.env.AUTH_SECRET,
};
2 changes: 2 additions & 0 deletions mock-server/src/core/servers/rest-api.server.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { ENV } from '#core/constants/env.constants.js';
import cookieParser from 'cookie-parser';
import express from 'express';

export const createRestApiServer = () => {
const app = express();
app.use(express.json());
app.use(cookieParser());
app.use((req, res, next) => {
setTimeout(next, ENV.SIMULATED_DELAY || 2000);
});
Expand Down
1 change: 1 addition & 0 deletions mock-server/src/dals/user/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './user.model.js';
export * from './user.repository.js';
4 changes: 3 additions & 1 deletion mock-server/src/dals/user/user.repository.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { paginateItems } from '#common/helpers/index.js';
import { CollectionQuery } from '#common/models/index.js';
import { CollectionQuery, UserCredentials } from '#common/models/index.js';
import { db } from '#dals/mock.data.js';
import * as model from './user.model.js';

Expand Down Expand Up @@ -27,4 +27,6 @@ export const userRepository = {
}
return index !== -1;
},
getUserByCredentials: async (userCredentials: UserCredentials) =>
db.users.find(user => user.email === userCredentials.email && user.contraseña === userCredentials.contraseña),
};
13 changes: 13 additions & 0 deletions mock-server/src/global-types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
declare namespace Express {
export interface UserSession {
id: string;
rol: {
id: string;
nombre: string;
};
}

export interface Request {
userSession?: UserSession;
}
}
4 changes: 3 additions & 1 deletion mock-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ import { createRestApiServer } from '#core/servers/index.js';
import { userApi } from '#pods/user/index.js';
import { expedienteApi } from '#pods/expediente/index.js';
import { lookupApi } from '#pods/lookup/index.js';
import { securityApi } from '#pods/security/security.rest-api.js';

const app = createRestApiServer();

app.use(logRequestMiddleware(logger));

app.use('/api/user', userApi);
app.use('/api/lookup', lookupApi);

app.use('/api/expediente', expedienteApi);
app.use('/api/security', securityApi);


app.use(logErrorRequestMiddleware(logger));

Expand Down
1 change: 1 addition & 0 deletions mock-server/src/pods/security/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './security.rest-api.js';
Loading