Add modular admin CRUD UI, fix MikroORM migrations/config and update static admin routing

This commit is contained in:
2026-03-18 16:52:05 -03:00
parent 56a926b10b
commit 9e60600a5d
19 changed files with 1921 additions and 563 deletions

View File

@@ -1 +1 @@
{"version":3,"file":"auth.guard.d.ts","sourceRoot":"","sources":["../../src/core/auth.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAqC,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,qBACa,SAAU,YAAW,WAAW;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAErD,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;CAgBhD"}
{"version":3,"file":"auth.guard.d.ts","sourceRoot":"","sources":["../../src/core/auth.guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAqC,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,qBACa,SAAU,YAAW,WAAW;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAErD,WAAW,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;CAuBhD"}

View File

@@ -18,6 +18,11 @@ let AuthGuard = class AuthGuard {
}
canActivate(context) {
const request = context.switchToHttp().getRequest();
// Allow the admin UI endpoints to be accessed without authentication.
// The UI is served from /admin and calls /api/admin/modules.
if (request.method === 'GET' && request.url?.startsWith('/api/admin')) {
return true;
}
const authHeader = request.headers['authorization'] || '';
const token = Array.isArray(authHeader) ? authHeader[0] : authHeader;
if (!token) {

View File

@@ -31,7 +31,7 @@ exports.CoreModule = CoreModule = __decorate([
user: process.env.DB_USER || 'postgres',
password: process.env.DB_PASSWORD || 'postgres',
dbName: process.env.DB_NAME || 'planner',
autoLoadEntities: false,
autoLoadEntities: true,
migrations: {
path: 'dist/migrations',
transactional: true,