ante-erp-cli 1.11.71 ā 1.11.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/ante-cli.js +2 -2
- package/package.json +1 -1
- package/src/commands/install.js +26 -59
- package/src/commands/regenerate-compose.js +2 -5
- package/src/commands/set-domain.js +7 -7
- package/src/commands/ssl-enable.js +2 -2
- package/src/commands/update.js +3 -5
- package/src/templates/docker-compose.yml.js +18 -88
- package/src/templates/env.js +4 -13
- package/src/templates/init-schema.sql +28 -28
- package/src/utils/nginx.js +4 -4
- package/src/utils/ssl.js +2 -2
- package/src/utils/validation.js +1 -1
package/bin/ante-cli.js
CHANGED
|
@@ -53,9 +53,9 @@ program
|
|
|
53
53
|
.command('install')
|
|
54
54
|
.description('Install ANTE ERP')
|
|
55
55
|
.option('-d, --dir <path>', 'Installation directory', './ante-erp')
|
|
56
|
-
.option('--frontend-domain <url>', 'Frontend domain/URL (e.g., https://app.example.com or http://IP:
|
|
56
|
+
.option('--frontend-domain <url>', 'Frontend domain/URL (e.g., https://app.example.com or http://IP:8085)')
|
|
57
57
|
.option('--api-domain <url>', 'API domain/URL (e.g., https://api.example.com or http://IP:3001)')
|
|
58
|
-
.option('--port <port>', '
|
|
58
|
+
.option('--port <port>', 'Backend API port', '3001')
|
|
59
59
|
.option('--preset <type>', 'Installation preset (minimal, standard, enterprise)', 'standard')
|
|
60
60
|
.option('--no-interactive', 'Non-interactive mode with defaults')
|
|
61
61
|
.option('--skip-checks', 'Skip system requirements check')
|
package/package.json
CHANGED
package/src/commands/install.js
CHANGED
|
@@ -8,6 +8,9 @@ import { mkdirSync, writeFileSync, existsSync, renameSync, readFileSync } from '
|
|
|
8
8
|
import { join, dirname } from 'path';
|
|
9
9
|
import { fileURLToPath } from 'url';
|
|
10
10
|
import { runSystemChecks, checkAndInstallDocker } from '../utils/validation.js';
|
|
11
|
+
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = dirname(__filename);
|
|
11
14
|
import { generateCredentials } from '../utils/password.js';
|
|
12
15
|
import { saveInstallConfig, detectInstallation } from '../utils/config.js';
|
|
13
16
|
import { pullImagesSilent, startServicesSilent, waitForServiceHealthy, runMigrations, downServices } from '../utils/docker.js';
|
|
@@ -17,9 +20,6 @@ import { detectPublicIPWithFeedback, buildURL } from '../utils/network.js';
|
|
|
17
20
|
import { configureNginx, requiresNginx } from '../utils/nginx.js';
|
|
18
21
|
import { applySysctlSettings } from '../utils/system-config.js';
|
|
19
22
|
|
|
20
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = dirname(__filename);
|
|
22
|
-
|
|
23
23
|
/**
|
|
24
24
|
* Backup existing .env file if it exists
|
|
25
25
|
* @param {string} envPath - Path to .env file
|
|
@@ -76,11 +76,9 @@ function showWelcome() {
|
|
|
76
76
|
* Show success message
|
|
77
77
|
*/
|
|
78
78
|
function showSuccess(installDir, credentials, config) {
|
|
79
|
-
const frontendUrl = config.frontendDomain || 'http://localhost:8080';
|
|
80
79
|
const apiUrl = config.apiDomain || 'http://localhost:3001';
|
|
81
80
|
const frontendCoreUrl = config.frontendCoreDomain || 'http://localhost:8085';
|
|
82
81
|
const frontendCoreMobileUrl = config.frontendCoreMobileDomain || 'http://localhost:8086';
|
|
83
|
-
const backendCoreUrl = config.backendCoreDomain || 'http://localhost:4002';
|
|
84
82
|
const gateAppUrl = config.gateAppDomain || 'http://localhost:8081';
|
|
85
83
|
const guardianAppUrl = config.guardianAppDomain || 'http://localhost:8082';
|
|
86
84
|
const facialWebUrl = config.facialAppDomain || 'http://localhost:8083';
|
|
@@ -89,33 +87,31 @@ function showSuccess(installDir, credentials, config) {
|
|
|
89
87
|
|
|
90
88
|
let accessInfo = chalk.white('Access Information:') + '\n' +
|
|
91
89
|
chalk.gray('ā'.repeat(40)) + '\n' +
|
|
92
|
-
chalk.cyan('Frontend
|
|
93
|
-
chalk.cyan('Frontend
|
|
94
|
-
chalk.cyan('Frontend Core Mobile: ') + chalk.white(frontendCoreMobileUrl) + '\n';
|
|
90
|
+
chalk.cyan('Frontend: ') + chalk.white(frontendCoreUrl) + '\n' +
|
|
91
|
+
chalk.cyan('Frontend Mobile: ') + chalk.white(frontendCoreMobileUrl) + '\n';
|
|
95
92
|
|
|
96
93
|
if (config.installGate) {
|
|
97
|
-
accessInfo += chalk.cyan('Gate App:
|
|
94
|
+
accessInfo += chalk.cyan('Gate App: ') + chalk.white(gateAppUrl) + '\n';
|
|
98
95
|
}
|
|
99
96
|
|
|
100
97
|
if (config.installGuardian) {
|
|
101
|
-
accessInfo += chalk.cyan('Guardian App:
|
|
98
|
+
accessInfo += chalk.cyan('Guardian App: ') + chalk.white(guardianAppUrl) + '\n';
|
|
102
99
|
}
|
|
103
100
|
|
|
104
101
|
if (config.installFacial) {
|
|
105
|
-
accessInfo += chalk.cyan('Facial Web:
|
|
102
|
+
accessInfo += chalk.cyan('Facial Web: ') + chalk.white(facialWebUrl) + '\n';
|
|
106
103
|
}
|
|
107
104
|
|
|
108
105
|
if (config.installPos) {
|
|
109
|
-
accessInfo += chalk.cyan('POS App:
|
|
106
|
+
accessInfo += chalk.cyan('POS App: ') + chalk.white(posAppUrl) + '\n';
|
|
110
107
|
}
|
|
111
108
|
|
|
112
109
|
if (config.installMlm) {
|
|
113
|
-
accessInfo += chalk.cyan('MLM App:
|
|
110
|
+
accessInfo += chalk.cyan('MLM App: ') + chalk.white(mlmAppUrl) + '\n';
|
|
114
111
|
}
|
|
115
112
|
|
|
116
|
-
accessInfo += chalk.cyan('Backend:
|
|
117
|
-
chalk.cyan('
|
|
118
|
-
chalk.cyan('WebSocket: ') + chalk.white(apiUrl) + '\n\n';
|
|
113
|
+
accessInfo += chalk.cyan('Backend API: ') + chalk.white(apiUrl) + '\n' +
|
|
114
|
+
chalk.cyan('WebSocket: ') + chalk.white(apiUrl) + '\n\n';
|
|
119
115
|
|
|
120
116
|
console.log(
|
|
121
117
|
boxen(
|
|
@@ -125,7 +121,7 @@ function showSuccess(installDir, credentials, config) {
|
|
|
125
121
|
chalk.white(`Credentials saved to:\n${installDir}/installation-credentials.txt`) + '\n' +
|
|
126
122
|
chalk.gray('Save this file securely!') + '\n\n' +
|
|
127
123
|
chalk.white('Next steps:') + '\n' +
|
|
128
|
-
chalk.gray(`1. Open ${
|
|
124
|
+
chalk.gray(`1. Open ${frontendCoreUrl} in your browser`) + '\n' +
|
|
129
125
|
chalk.gray('2. Create your admin account') + '\n' +
|
|
130
126
|
chalk.gray('3. Explore the documentation at https://docs.ante.ph') + '\n\n' +
|
|
131
127
|
chalk.white('To change domain/IP later:') + '\n' +
|
|
@@ -272,7 +268,7 @@ export async function install(options) {
|
|
|
272
268
|
const stepPullImages = ++currentStep;
|
|
273
269
|
const stepStartServices = ++currentStep;
|
|
274
270
|
const stepWaitServices = ++currentStep;
|
|
275
|
-
const
|
|
271
|
+
const stepInitSchema = ++currentStep;
|
|
276
272
|
const stepRunMigrations = ++currentStep;
|
|
277
273
|
|
|
278
274
|
// Start installation
|
|
@@ -322,10 +318,8 @@ export async function install(options) {
|
|
|
322
318
|
|
|
323
319
|
// Build configuration (non-interactive, enterprise preset with all frontends)
|
|
324
320
|
const host = detectedIP || 'localhost';
|
|
325
|
-
const frontendPort = parseInt(options.port) || 8080;
|
|
326
321
|
const apiPort = 3001;
|
|
327
322
|
const backendMlmPort = 4001;
|
|
328
|
-
const backendCorePort = 4002;
|
|
329
323
|
const frontendCorePort = 8085;
|
|
330
324
|
const frontendCoreMobilePort = 8086;
|
|
331
325
|
const gateAppPort = 8081;
|
|
@@ -337,10 +331,8 @@ export async function install(options) {
|
|
|
337
331
|
const config = {
|
|
338
332
|
installDir: options.dir || './ante-erp',
|
|
339
333
|
preset: 'enterprise', // Always install all features
|
|
340
|
-
frontendDomain: buildURL(host, frontendPort),
|
|
341
334
|
apiDomain: buildURL(host, apiPort),
|
|
342
335
|
mlmApiDomain: buildURL(host, backendMlmPort),
|
|
343
|
-
backendCoreDomain: buildURL(host, backendCorePort),
|
|
344
336
|
frontendCoreDomain: buildURL(host, frontendCorePort),
|
|
345
337
|
frontendCoreMobileDomain: buildURL(host, frontendCoreMobilePort),
|
|
346
338
|
gateAppDomain: buildURL(host, gateAppPort),
|
|
@@ -348,10 +340,8 @@ export async function install(options) {
|
|
|
348
340
|
facialAppDomain: buildURL(host, facialWebPort),
|
|
349
341
|
posAppDomain: buildURL(host, posAppPort),
|
|
350
342
|
mlmAppDomain: buildURL(host, mlmAppPort),
|
|
351
|
-
frontendPort,
|
|
352
343
|
apiPort,
|
|
353
344
|
backendMlmPort,
|
|
354
|
-
backendCorePort,
|
|
355
345
|
frontendCorePort,
|
|
356
346
|
frontendCoreMobilePort,
|
|
357
347
|
gateAppPort,
|
|
@@ -365,7 +355,7 @@ export async function install(options) {
|
|
|
365
355
|
installFacial: true,
|
|
366
356
|
installPos: true,
|
|
367
357
|
installMlm: true,
|
|
368
|
-
frontends: ['
|
|
358
|
+
frontends: ['gate', 'guardian', 'facial', 'pos', 'mlm', 'core', 'core-mobile']
|
|
369
359
|
};
|
|
370
360
|
|
|
371
361
|
console.log(chalk.green(`ā ${formatStepTitle(stepNetworkDetect, totalSteps, `Network detected: ${host}`)}\n`));
|
|
@@ -373,16 +363,14 @@ export async function install(options) {
|
|
|
373
363
|
// Display configuration summary (compact)
|
|
374
364
|
console.log(chalk.bold('š Installation Configuration:\n'));
|
|
375
365
|
console.log(chalk.cyan(' Directory:'), chalk.white(config.installDir));
|
|
376
|
-
console.log(chalk.cyan(' Frontend
|
|
377
|
-
console.log(chalk.cyan(' Frontend
|
|
378
|
-
console.log(chalk.cyan(' Frontend Core Mobile:'), chalk.white(config.frontendCoreMobileDomain));
|
|
366
|
+
console.log(chalk.cyan(' Frontend:'), chalk.white(config.frontendCoreDomain));
|
|
367
|
+
console.log(chalk.cyan(' Frontend Mobile:'), chalk.white(config.frontendCoreMobileDomain));
|
|
379
368
|
console.log(chalk.cyan(' Gate App:'), chalk.white(config.gateAppDomain));
|
|
380
369
|
console.log(chalk.cyan(' Guardian App:'), chalk.white(config.guardianAppDomain));
|
|
381
370
|
console.log(chalk.cyan(' Facial Web:'), chalk.white(config.facialAppDomain));
|
|
382
371
|
console.log(chalk.cyan(' POS App:'), chalk.white(config.posAppDomain));
|
|
383
372
|
console.log(chalk.cyan(' MLM App:'), chalk.white(config.mlmAppDomain));
|
|
384
373
|
console.log(chalk.cyan(' API:'), chalk.white(config.apiDomain));
|
|
385
|
-
console.log(chalk.cyan(' Backend Core:'), chalk.white(config.backendCoreDomain));
|
|
386
374
|
console.log(chalk.cyan(' MLM API:'), chalk.white(config.mlmApiDomain));
|
|
387
375
|
console.log();
|
|
388
376
|
|
|
@@ -457,10 +445,8 @@ export async function install(options) {
|
|
|
457
445
|
title: formatStepTitle(stepGenerateConfig, totalSteps, 'Generating configuration files'),
|
|
458
446
|
task: () => {
|
|
459
447
|
const dockerCompose = generateDockerCompose({
|
|
460
|
-
frontendPort: config.frontendPort,
|
|
461
448
|
backendPort: config.apiPort,
|
|
462
449
|
backendMlmPort: config.backendMlmPort,
|
|
463
|
-
backendCorePort: config.backendCorePort,
|
|
464
450
|
frontendCorePort: config.frontendCorePort,
|
|
465
451
|
frontendCoreMobilePort: config.frontendCoreMobilePort,
|
|
466
452
|
gateAppPort: config.gateAppPort,
|
|
@@ -468,7 +454,6 @@ export async function install(options) {
|
|
|
468
454
|
facialWebPort: config.facialWebPort,
|
|
469
455
|
posAppPort: config.posAppPort,
|
|
470
456
|
mlmAppPort: config.mlmAppPort,
|
|
471
|
-
installMain: true,
|
|
472
457
|
installGate: config.installGate,
|
|
473
458
|
installGuardian: config.installGuardian,
|
|
474
459
|
installFacial: config.installFacial,
|
|
@@ -478,13 +463,11 @@ export async function install(options) {
|
|
|
478
463
|
});
|
|
479
464
|
|
|
480
465
|
const envContent = generateEnv(credentials, {
|
|
481
|
-
frontendUrl: config.
|
|
466
|
+
frontendUrl: config.frontendCoreDomain,
|
|
482
467
|
apiUrl: config.apiDomain,
|
|
483
468
|
socketUrl: config.apiDomain,
|
|
484
|
-
frontendPort: config.frontendPort,
|
|
485
469
|
backendPort: config.apiPort,
|
|
486
470
|
backendMlmPort: config.backendMlmPort,
|
|
487
|
-
backendCorePort: config.backendCorePort,
|
|
488
471
|
frontendCorePort: config.frontendCorePort,
|
|
489
472
|
frontendCoreMobilePort: config.frontendCoreMobilePort,
|
|
490
473
|
gateAppPort: config.gateAppPort,
|
|
@@ -500,7 +483,6 @@ export async function install(options) {
|
|
|
500
483
|
mlmApiUrl: config.mlmApiDomain,
|
|
501
484
|
frontendCoreUrl: config.frontendCoreDomain,
|
|
502
485
|
frontendCoreMobileUrl: config.frontendCoreMobileDomain,
|
|
503
|
-
backendCoreUrl: config.backendCoreDomain,
|
|
504
486
|
companyId: config.companyId,
|
|
505
487
|
installGate: config.installGate,
|
|
506
488
|
installGuardian: config.installGuardian,
|
|
@@ -532,7 +514,7 @@ Encryption Key: ${credentials.encryptionKey}
|
|
|
532
514
|
|
|
533
515
|
Access Information:
|
|
534
516
|
āāāāāāāāāāāāāāāāāāā
|
|
535
|
-
Frontend: ${config.
|
|
517
|
+
Frontend: ${config.frontendCoreDomain}
|
|
536
518
|
Backend: ${config.apiDomain}
|
|
537
519
|
WebSocket: ${config.apiDomain}
|
|
538
520
|
|
|
@@ -581,7 +563,7 @@ Support: support@ante.ph
|
|
|
581
563
|
}
|
|
582
564
|
},
|
|
583
565
|
{
|
|
584
|
-
title: formatStepTitle(
|
|
566
|
+
title: formatStepTitle(stepInitSchema, totalSteps, 'Initializing database schema'),
|
|
585
567
|
task: async () => {
|
|
586
568
|
const composeFile = join(config.installDir, 'docker-compose.yml');
|
|
587
569
|
const schemaFile = join(__dirname, '../templates/init-schema.sql');
|
|
@@ -589,7 +571,7 @@ Support: support@ante.ph
|
|
|
589
571
|
try {
|
|
590
572
|
const schemaSQL = readFileSync(schemaFile, 'utf8');
|
|
591
573
|
|
|
592
|
-
// Execute schema SQL in postgres container
|
|
574
|
+
// Execute schema SQL in postgres container to create base tables
|
|
593
575
|
await execa('docker', [
|
|
594
576
|
'compose',
|
|
595
577
|
'-f', composeFile,
|
|
@@ -604,23 +586,8 @@ Support: support@ante.ph
|
|
|
604
586
|
stdout: 'pipe',
|
|
605
587
|
stderr: 'pipe'
|
|
606
588
|
});
|
|
607
|
-
|
|
608
|
-
// Run production seed command
|
|
609
|
-
await execa('docker', [
|
|
610
|
-
'compose',
|
|
611
|
-
'-f', composeFile,
|
|
612
|
-
'exec',
|
|
613
|
-
'-T',
|
|
614
|
-
'backend',
|
|
615
|
-
'npm',
|
|
616
|
-
'run',
|
|
617
|
-
'seed:prod'
|
|
618
|
-
], {
|
|
619
|
-
stdout: 'pipe',
|
|
620
|
-
stderr: 'pipe'
|
|
621
|
-
});
|
|
622
589
|
} catch (error) {
|
|
623
|
-
throw new Error(`
|
|
590
|
+
throw new Error(`Schema initialization failed: ${error.message}`);
|
|
624
591
|
}
|
|
625
592
|
}
|
|
626
593
|
},
|
|
@@ -634,7 +601,7 @@ Support: support@ante.ph
|
|
|
634
601
|
throw new Error(`Migration failed:\n${result.output}`);
|
|
635
602
|
}
|
|
636
603
|
}
|
|
637
|
-
}
|
|
604
|
+
},
|
|
638
605
|
], {
|
|
639
606
|
renderer: 'default',
|
|
640
607
|
rendererOptions: {
|
|
@@ -651,12 +618,12 @@ Support: support@ante.ph
|
|
|
651
618
|
await tasks.run();
|
|
652
619
|
|
|
653
620
|
// Configure NGINX if needed (silent)
|
|
654
|
-
if (requiresNginx(config.
|
|
621
|
+
if (requiresNginx(config.frontendCoreDomain, config.apiDomain)) {
|
|
655
622
|
try {
|
|
656
623
|
await configureNginx({
|
|
657
|
-
frontendDomain: config.
|
|
624
|
+
frontendDomain: config.frontendCoreDomain,
|
|
658
625
|
apiDomain: config.apiDomain,
|
|
659
|
-
frontendPort: config.
|
|
626
|
+
frontendPort: config.frontendCorePort,
|
|
660
627
|
apiPort: config.apiPort
|
|
661
628
|
});
|
|
662
629
|
} catch (error) {
|
|
@@ -32,7 +32,6 @@ function detectInstalledApps(composeFile) {
|
|
|
32
32
|
try {
|
|
33
33
|
const composeContent = readFileSync(composeFile, 'utf8');
|
|
34
34
|
return {
|
|
35
|
-
hasMain: composeContent.includes('frontend:') || composeContent.includes('container_name: ante-frontend'),
|
|
36
35
|
hasGateApp: composeContent.includes('gate-app:') || composeContent.includes('container_name: ante-gate-app'),
|
|
37
36
|
hasGuardianApp: composeContent.includes('guardian-app:') || composeContent.includes('container_name: ante-guardian-app'),
|
|
38
37
|
hasFacialWeb: composeContent.includes('facial-web:') || composeContent.includes('container_name: ante-facial-web'),
|
|
@@ -40,7 +39,7 @@ function detectInstalledApps(composeFile) {
|
|
|
40
39
|
hasMlmApp: composeContent.includes('mlm-app:') || composeContent.includes('container_name: ante-mlm')
|
|
41
40
|
};
|
|
42
41
|
} catch {
|
|
43
|
-
return {
|
|
42
|
+
return { hasGateApp: false, hasGuardianApp: false, hasFacialWeb: false, hasPosApp: false, hasMlmApp: false };
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
|
|
@@ -73,7 +72,6 @@ export async function regenerateCompose() {
|
|
|
73
72
|
// Detect installed apps
|
|
74
73
|
const installed = detectInstalledApps(composeFile);
|
|
75
74
|
console.log(chalk.cyan('Detected Configuration:'));
|
|
76
|
-
console.log(chalk.gray(` Frontend Main: ${installed.hasMain ? 'ā Installed' : 'ā Not installed'}`));
|
|
77
75
|
console.log(chalk.gray(` Backend Core: ā Always Included`));
|
|
78
76
|
console.log(chalk.gray(` Frontend Core: ā Always Included`));
|
|
79
77
|
console.log(chalk.gray(` Frontend Core Mobile: ā Always Included`));
|
|
@@ -87,7 +85,7 @@ export async function regenerateCompose() {
|
|
|
87
85
|
const envConfig = parseEnvFile(envFile);
|
|
88
86
|
|
|
89
87
|
// Extract port configuration
|
|
90
|
-
const frontendPort = parseInt(envConfig.FRONTEND_PORT) ||
|
|
88
|
+
const frontendPort = parseInt(envConfig.FRONTEND_PORT) || 8085;
|
|
91
89
|
const backendPort = parseInt(envConfig.BACKEND_PORT) || 3001;
|
|
92
90
|
const backendMlmPort = parseInt(envConfig.BACKEND_MLM_PORT) || 4001;
|
|
93
91
|
const backendCorePort = parseInt(envConfig.BACKEND_CORE_PORT) || 4002;
|
|
@@ -146,7 +144,6 @@ export async function regenerateCompose() {
|
|
|
146
144
|
facialWebPort,
|
|
147
145
|
posAppPort,
|
|
148
146
|
mlmAppPort,
|
|
149
|
-
installMain: installed.hasMain,
|
|
150
147
|
installGate: installed.hasGateApp,
|
|
151
148
|
installGuardian: installed.hasGuardianApp,
|
|
152
149
|
installFacial: installed.hasFacialWeb,
|
|
@@ -251,7 +251,7 @@ export async function setDomain(options) {
|
|
|
251
251
|
type: 'number',
|
|
252
252
|
name: 'frontendPort',
|
|
253
253
|
message: 'Frontend port:',
|
|
254
|
-
default:
|
|
254
|
+
default: 8085
|
|
255
255
|
}
|
|
256
256
|
];
|
|
257
257
|
|
|
@@ -322,7 +322,7 @@ export async function setDomain(options) {
|
|
|
322
322
|
type: 'number',
|
|
323
323
|
name: 'frontendPort',
|
|
324
324
|
message: 'Frontend port:',
|
|
325
|
-
default:
|
|
325
|
+
default: 8085
|
|
326
326
|
}
|
|
327
327
|
];
|
|
328
328
|
|
|
@@ -402,7 +402,7 @@ export async function setDomain(options) {
|
|
|
402
402
|
type: 'number',
|
|
403
403
|
name: 'frontendPort',
|
|
404
404
|
message: 'Frontend port:',
|
|
405
|
-
default:
|
|
405
|
+
default: 8085
|
|
406
406
|
}
|
|
407
407
|
];
|
|
408
408
|
|
|
@@ -549,8 +549,8 @@ export async function setDomain(options) {
|
|
|
549
549
|
{
|
|
550
550
|
type: 'input',
|
|
551
551
|
name: 'frontendUrl',
|
|
552
|
-
message: 'Frontend URL:\n Examples: https://staging.ante.ph or http://143.198.91.153:
|
|
553
|
-
default: currentFrontendUrl || 'http://localhost:
|
|
552
|
+
message: 'Frontend URL:\n Examples: https://staging.ante.ph or http://143.198.91.153:8085\n Enter URL',
|
|
553
|
+
default: currentFrontendUrl || 'http://localhost:8085',
|
|
554
554
|
validate: validateUrl
|
|
555
555
|
}
|
|
556
556
|
];
|
|
@@ -856,7 +856,7 @@ export async function setDomain(options) {
|
|
|
856
856
|
const nginxConfig = {
|
|
857
857
|
frontendDomain: frontendUrl,
|
|
858
858
|
apiDomain: apiUrl,
|
|
859
|
-
frontendPort:
|
|
859
|
+
frontendPort: 8085,
|
|
860
860
|
apiPort: 3001,
|
|
861
861
|
cloudflareSsl
|
|
862
862
|
};
|
|
@@ -1092,7 +1092,7 @@ export async function setDomain(options) {
|
|
|
1092
1092
|
const sslNginxConfig = {
|
|
1093
1093
|
frontendDomain: frontendUrl,
|
|
1094
1094
|
apiDomain: apiUrl,
|
|
1095
|
-
frontendPort:
|
|
1095
|
+
frontendPort: 8085,
|
|
1096
1096
|
apiPort: 3001,
|
|
1097
1097
|
domainsWithCerts: successfulDomains
|
|
1098
1098
|
};
|
|
@@ -272,7 +272,7 @@ export async function sslEnable(options) {
|
|
|
272
272
|
domains.push({
|
|
273
273
|
name: 'Frontend',
|
|
274
274
|
domain: frontendDomain,
|
|
275
|
-
port: frontendUrl.match(/:(\d+)/) ? frontendUrl.match(/:(\d+)/)[1] :
|
|
275
|
+
port: frontendUrl.match(/:(\d+)/) ? frontendUrl.match(/:(\d+)/)[1] : 8085,
|
|
276
276
|
url: frontendUrl
|
|
277
277
|
});
|
|
278
278
|
}
|
|
@@ -507,7 +507,7 @@ export async function sslEnable(options) {
|
|
|
507
507
|
|
|
508
508
|
try {
|
|
509
509
|
// Extract ports for all services
|
|
510
|
-
const frontendPort = frontendUrl.match(/:(\d+)/) ? parseInt(frontendUrl.match(/:(\d+)/)[1]) :
|
|
510
|
+
const frontendPort = frontendUrl.match(/:(\d+)/) ? parseInt(frontendUrl.match(/:(\d+)/)[1]) : 8085;
|
|
511
511
|
const apiPort = apiUrl.match(/:(\d+)/) ? parseInt(apiUrl.match(/:(\d+)/)[1]) : 3001;
|
|
512
512
|
|
|
513
513
|
const sslConfig = {
|
package/src/commands/update.js
CHANGED
|
@@ -79,7 +79,7 @@ function updateDockerCompose(composeFile, envFile, newServices) {
|
|
|
79
79
|
|
|
80
80
|
// Generate new docker-compose.yml with all services
|
|
81
81
|
const newCompose = generateDockerCompose({
|
|
82
|
-
frontendPort: parseInt(envConfig.FRONTEND_PORT) ||
|
|
82
|
+
frontendPort: parseInt(envConfig.FRONTEND_PORT) || 8085,
|
|
83
83
|
backendPort: parseInt(envConfig.BACKEND_PORT) || 3001,
|
|
84
84
|
backendMlmPort: parseInt(envConfig.BACKEND_MLM_PORT) || 4001,
|
|
85
85
|
backendCorePort: parseInt(envConfig.BACKEND_CORE_PORT) || 4002,
|
|
@@ -90,7 +90,6 @@ function updateDockerCompose(composeFile, envFile, newServices) {
|
|
|
90
90
|
facialWebPort: parseInt(envConfig.FACIAL_WEB_PORT) || 8083,
|
|
91
91
|
posAppPort: parseInt(envConfig.POS_APP_PORT) || 8084,
|
|
92
92
|
mlmAppPort: parseInt(envConfig.MLM_APP_PORT) || 9005,
|
|
93
|
-
installMain: true,
|
|
94
93
|
installGate: currentInstalled.hasGateApp || newServices.gateApp,
|
|
95
94
|
installGuardian: currentInstalled.hasGuardianApp || newServices.guardianApp,
|
|
96
95
|
installFacial: currentInstalled.hasFacialWeb || newServices.facialWeb,
|
|
@@ -347,7 +346,7 @@ function refreshDockerCompose(composeFile, envFile) {
|
|
|
347
346
|
|
|
348
347
|
// Generate new docker-compose.yml with existing services only
|
|
349
348
|
const newCompose = generateDockerCompose({
|
|
350
|
-
frontendPort: parseInt(envConfig.FRONTEND_PORT) ||
|
|
349
|
+
frontendPort: parseInt(envConfig.FRONTEND_PORT) || 8085,
|
|
351
350
|
backendPort: parseInt(envConfig.BACKEND_PORT) || 3001,
|
|
352
351
|
backendMlmPort: parseInt(envConfig.BACKEND_MLM_PORT) || 4001,
|
|
353
352
|
backendCorePort: parseInt(envConfig.BACKEND_CORE_PORT) || 4002,
|
|
@@ -358,7 +357,6 @@ function refreshDockerCompose(composeFile, envFile) {
|
|
|
358
357
|
facialWebPort: parseInt(envConfig.FACIAL_WEB_PORT) || 8083,
|
|
359
358
|
posAppPort: parseInt(envConfig.POS_APP_PORT) || 8084,
|
|
360
359
|
mlmAppPort: parseInt(envConfig.MLM_APP_PORT) || 9005,
|
|
361
|
-
installMain: true,
|
|
362
360
|
installGate: currentInstalled.hasGateApp,
|
|
363
361
|
installGuardian: currentInstalled.hasGuardianApp,
|
|
364
362
|
installFacial: currentInstalled.hasFacialWeb,
|
|
@@ -401,7 +399,7 @@ function getRequiredPorts(composeFile, envFile) {
|
|
|
401
399
|
|
|
402
400
|
// Core services - always needed
|
|
403
401
|
ports.push(parseInt(envConfig.BACKEND_PORT) || 3001); // Backend
|
|
404
|
-
ports.push(parseInt(envConfig.FRONTEND_PORT) ||
|
|
402
|
+
ports.push(parseInt(envConfig.FRONTEND_PORT) || 8085); // Frontend
|
|
405
403
|
ports.push(parseInt(envConfig.BACKEND_CORE_PORT) || 4002); // Backend Core (always included)
|
|
406
404
|
ports.push(parseInt(envConfig.FRONTEND_CORE_PORT) || 8085); // Frontend Core (always included)
|
|
407
405
|
ports.push(parseInt(envConfig.FRONTEND_CORE_MOBILE_PORT) || 8086); // Frontend Core Mobile (always included)
|
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export function generateDockerCompose(options = {}) {
|
|
7
7
|
const {
|
|
8
|
-
frontendPort = 8080,
|
|
9
8
|
backendPort = 3001,
|
|
10
9
|
backendMlmPort = 4001,
|
|
11
|
-
backendCorePort = 4002,
|
|
12
10
|
frontendCorePort = 8085,
|
|
13
11
|
frontendCoreMobilePort = 8086,
|
|
14
12
|
gateAppPort = 8081,
|
|
@@ -27,8 +25,6 @@ export function generateDockerCompose(options = {}) {
|
|
|
27
25
|
return `# ANTE ERP - Docker Compose Configuration
|
|
28
26
|
# Generated by ANTE CLI
|
|
29
27
|
|
|
30
|
-
version: '3.8'
|
|
31
|
-
|
|
32
28
|
services:
|
|
33
29
|
# PostgreSQL Database
|
|
34
30
|
postgres:
|
|
@@ -98,22 +94,20 @@ services:
|
|
|
98
94
|
networks:
|
|
99
95
|
- ante-network
|
|
100
96
|
healthcheck:
|
|
101
|
-
test:
|
|
102
|
-
echo 'db.runCommand("ping").ok' |
|
|
103
|
-
mongosh localhost:27017/test --quiet --username ante --password \${MONGO_PASSWORD} --authenticationDatabase admin
|
|
97
|
+
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')", "--quiet", "localhost:27017/test", "--username", "ante", "--password", "\${MONGO_PASSWORD}", "--authenticationDatabase", "admin"]
|
|
104
98
|
interval: 10s
|
|
105
|
-
timeout:
|
|
106
|
-
retries:
|
|
107
|
-
start_period:
|
|
99
|
+
timeout: 10s
|
|
100
|
+
retries: 10
|
|
101
|
+
start_period: 30s
|
|
108
102
|
logging:
|
|
109
103
|
driver: "json-file"
|
|
110
104
|
options:
|
|
111
105
|
max-size: "10m"
|
|
112
106
|
max-file: "3"
|
|
113
107
|
|
|
114
|
-
# ANTE Backend
|
|
108
|
+
# ANTE Backend (Core)
|
|
115
109
|
backend:
|
|
116
|
-
image: ghcr.io/gtplusnet/ante-self-hosted-backend:latest
|
|
110
|
+
image: ghcr.io/gtplusnet/ante-self-hosted-backend-core:latest
|
|
117
111
|
container_name: ante-backend
|
|
118
112
|
restart: unless-stopped
|
|
119
113
|
depends_on:
|
|
@@ -125,7 +119,7 @@ services:
|
|
|
125
119
|
condition: service_healthy
|
|
126
120
|
environment:
|
|
127
121
|
NODE_ENV: production
|
|
128
|
-
|
|
122
|
+
BACKEND_CORE_PORT: 4002
|
|
129
123
|
DATABASE_URL: postgresql://ante:\${DB_PASSWORD}@postgres:5432/ante_db?schema=public&connection_limit=10
|
|
130
124
|
DIRECT_URL: postgresql://ante:\${DB_PASSWORD}@postgres:5432/ante_db?schema=public
|
|
131
125
|
REDIS_HOST: redis
|
|
@@ -141,7 +135,7 @@ services:
|
|
|
141
135
|
CUSTOMER_APP_JWT_SECRET: \${CUSTOMER_APP_JWT_SECRET}
|
|
142
136
|
CUSTOMER_APP_JWT_EXPIRY: \${CUSTOMER_APP_JWT_EXPIRY:-1y}
|
|
143
137
|
CUSTOMER_APP_REFRESH_TOKEN_EXPIRY: \${CUSTOMER_APP_REFRESH_TOKEN_EXPIRY:-1y}
|
|
144
|
-
FRONTEND_URL: \${FRONTEND_URL:-http://localhost:${
|
|
138
|
+
FRONTEND_URL: \${FRONTEND_URL:-http://localhost:${frontendCorePort}}
|
|
145
139
|
API_URL: \${API_URL:-http://localhost:${backendPort}}
|
|
146
140
|
SOCKET_URL: \${SOCKET_URL:-http://localhost:${backendPort}}
|
|
147
141
|
SMTP_HOST: \${SMTP_HOST:-}
|
|
@@ -154,16 +148,16 @@ services:
|
|
|
154
148
|
UPLOAD_MAX_SIZE: \${UPLOAD_MAX_SIZE:-10485760}
|
|
155
149
|
TZ: \${TZ:-Asia/Manila}
|
|
156
150
|
ports:
|
|
157
|
-
- "${backendPort}:
|
|
151
|
+
- "${backendPort}:4002"
|
|
158
152
|
volumes:
|
|
159
153
|
- backend_uploads:/app/uploads
|
|
160
154
|
networks:
|
|
161
155
|
- ante-network
|
|
162
156
|
healthcheck:
|
|
163
|
-
test: ["CMD", "curl", "-f", "http://localhost:
|
|
157
|
+
test: ["CMD", "curl", "-f", "http://localhost:4002/health"]
|
|
164
158
|
interval: 30s
|
|
165
159
|
timeout: 10s
|
|
166
|
-
retries:
|
|
160
|
+
retries: 5
|
|
167
161
|
start_period: 60s
|
|
168
162
|
logging:
|
|
169
163
|
driver: "json-file"
|
|
@@ -171,77 +165,16 @@ services:
|
|
|
171
165
|
max-size: "50m"
|
|
172
166
|
max-file: "5"
|
|
173
167
|
|
|
174
|
-
# ANTE Frontend Main
|
|
175
|
-
frontend:
|
|
176
|
-
image: ghcr.io/gtplusnet/ante-self-hosted-frontend-main:latest
|
|
177
|
-
container_name: ante-frontend
|
|
178
|
-
restart: unless-stopped
|
|
179
|
-
depends_on:
|
|
180
|
-
backend:
|
|
181
|
-
condition: service_healthy
|
|
182
|
-
environment:
|
|
183
|
-
- API_URL=\${API_URL:-http://localhost:${backendPort}}
|
|
184
|
-
- SOCKET_URL=\${SOCKET_URL:-http://localhost:${backendPort}}
|
|
185
|
-
ports:
|
|
186
|
-
- "${frontendPort}:8080"
|
|
187
|
-
networks:
|
|
188
|
-
- ante-network
|
|
189
|
-
healthcheck:
|
|
190
|
-
test: ["CMD", "curl", "-f", "http://localhost:8080"]
|
|
191
|
-
interval: 30s
|
|
192
|
-
timeout: 10s
|
|
193
|
-
retries: 3
|
|
194
|
-
logging:
|
|
195
|
-
driver: "json-file"
|
|
196
|
-
options:
|
|
197
|
-
max-size: "10m"
|
|
198
|
-
max-file: "3"
|
|
199
|
-
|
|
200
|
-
# ANTE Backend Core - Express.js API for Frontend Core
|
|
201
|
-
backend-core:
|
|
202
|
-
image: ghcr.io/gtplusnet/ante-self-hosted-backend-core:latest
|
|
203
|
-
container_name: ante-backend-core
|
|
204
|
-
restart: unless-stopped
|
|
205
|
-
depends_on:
|
|
206
|
-
backend:
|
|
207
|
-
condition: service_healthy
|
|
208
|
-
environment:
|
|
209
|
-
NODE_ENV: production
|
|
210
|
-
BACKEND_CORE_PORT: 4002
|
|
211
|
-
DATABASE_URL: postgresql://ante:\${DB_PASSWORD}@postgres:5432/ante_db?schema=public&connection_limit=10
|
|
212
|
-
DIRECT_URL: postgresql://ante:\${DB_PASSWORD}@postgres:5432/ante_db?schema=public
|
|
213
|
-
REDIS_HOST: redis
|
|
214
|
-
REDIS_PORT: 6379
|
|
215
|
-
REDIS_PASSWORD: \${REDIS_PASSWORD}
|
|
216
|
-
JWT_SECRET: \${JWT_SECRET}
|
|
217
|
-
ENCRYPTION_KEY: \${ENCRYPTION_KEY}
|
|
218
|
-
TZ: \${TZ:-Asia/Manila}
|
|
219
|
-
ports:
|
|
220
|
-
- "${backendCorePort}:4002"
|
|
221
|
-
networks:
|
|
222
|
-
- ante-network
|
|
223
|
-
healthcheck:
|
|
224
|
-
test: ["CMD", "curl", "-f", "http://localhost:4002/health"]
|
|
225
|
-
interval: 30s
|
|
226
|
-
timeout: 10s
|
|
227
|
-
retries: 3
|
|
228
|
-
start_period: 30s
|
|
229
|
-
logging:
|
|
230
|
-
driver: "json-file"
|
|
231
|
-
options:
|
|
232
|
-
max-size: "10m"
|
|
233
|
-
max-file: "3"
|
|
234
|
-
|
|
235
168
|
# ANTE Frontend Core - React Application
|
|
236
169
|
frontend-core:
|
|
237
170
|
image: ghcr.io/gtplusnet/ante-self-hosted-frontend-core:latest
|
|
238
171
|
container_name: ante-frontend-core
|
|
239
172
|
restart: unless-stopped
|
|
240
173
|
depends_on:
|
|
241
|
-
backend
|
|
174
|
+
backend:
|
|
242
175
|
condition: service_healthy
|
|
243
176
|
environment:
|
|
244
|
-
- VITE_API_URL=\${
|
|
177
|
+
- VITE_API_URL=\${API_URL:-http://localhost:${backendPort}}
|
|
245
178
|
- VITE_APP_NAME=ANTE Frontend Core
|
|
246
179
|
- VITE_APP_VERSION=\${VERSION:-1.0.0}
|
|
247
180
|
ports:
|
|
@@ -266,10 +199,10 @@ services:
|
|
|
266
199
|
container_name: ante-frontend-core-mobile
|
|
267
200
|
restart: unless-stopped
|
|
268
201
|
depends_on:
|
|
269
|
-
backend
|
|
202
|
+
backend:
|
|
270
203
|
condition: service_healthy
|
|
271
204
|
environment:
|
|
272
|
-
- VITE_API_URL=\${
|
|
205
|
+
- VITE_API_URL=\${API_URL:-http://localhost:${backendPort}}
|
|
273
206
|
- VITE_APP_NAME=ANTE Frontend Core Mobile
|
|
274
207
|
- VITE_APP_VERSION=\${VERSION:-1.0.0}
|
|
275
208
|
ports:
|
|
@@ -306,13 +239,12 @@ ${installGate ? `
|
|
|
306
239
|
- "${gateAppPort}:3000"
|
|
307
240
|
networks:
|
|
308
241
|
- ante-network
|
|
309
|
-
# Security hardening
|
|
310
242
|
security_opt:
|
|
311
243
|
- no-new-privileges:true
|
|
312
244
|
tmpfs:
|
|
313
245
|
- /tmp:noexec,nosuid,size=100m
|
|
314
246
|
healthcheck:
|
|
315
|
-
test: ["CMD", "
|
|
247
|
+
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/"]
|
|
316
248
|
interval: 30s
|
|
317
249
|
timeout: 10s
|
|
318
250
|
retries: 3
|
|
@@ -339,13 +271,12 @@ ${installGate ? `
|
|
|
339
271
|
- "${guardianAppPort}:9003"
|
|
340
272
|
networks:
|
|
341
273
|
- ante-network
|
|
342
|
-
# Security hardening
|
|
343
274
|
security_opt:
|
|
344
275
|
- no-new-privileges:true
|
|
345
276
|
tmpfs:
|
|
346
277
|
- /tmp:noexec,nosuid,size=100m
|
|
347
278
|
healthcheck:
|
|
348
|
-
test: ["CMD", "
|
|
279
|
+
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9003/"]
|
|
349
280
|
interval: 30s
|
|
350
281
|
timeout: 10s
|
|
351
282
|
retries: 3
|
|
@@ -372,7 +303,7 @@ ${installGate ? `
|
|
|
372
303
|
networks:
|
|
373
304
|
- ante-network
|
|
374
305
|
healthcheck:
|
|
375
|
-
test: ["CMD", "
|
|
306
|
+
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:5173/"]
|
|
376
307
|
interval: 30s
|
|
377
308
|
timeout: 10s
|
|
378
309
|
retries: 3
|
|
@@ -491,4 +422,3 @@ networks:
|
|
|
491
422
|
driver: bridge
|
|
492
423
|
`;
|
|
493
424
|
}
|
|
494
|
-
|
package/src/templates/env.js
CHANGED
|
@@ -6,13 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export function generateEnv(credentials, options = {}) {
|
|
8
8
|
const {
|
|
9
|
-
frontendUrl = 'http://localhost:
|
|
9
|
+
frontendUrl = 'http://localhost:8085',
|
|
10
10
|
apiUrl = 'http://localhost:3001',
|
|
11
|
-
socketUrl = 'http://localhost:3001',
|
|
12
|
-
frontendPort = 8080,
|
|
11
|
+
socketUrl = 'http://localhost:3001',
|
|
13
12
|
backendPort = 3001,
|
|
14
13
|
backendMlmPort = 4001,
|
|
15
|
-
backendCorePort = 4002,
|
|
16
14
|
frontendCorePort = 8085,
|
|
17
15
|
frontendCoreMobilePort = 8086,
|
|
18
16
|
gateAppPort = 8081,
|
|
@@ -28,7 +26,6 @@ export function generateEnv(credentials, options = {}) {
|
|
|
28
26
|
mlmApiUrl = 'http://localhost:4001',
|
|
29
27
|
frontendCoreUrl = 'http://localhost:8085',
|
|
30
28
|
frontendCoreMobileUrl = 'http://localhost:8086',
|
|
31
|
-
backendCoreUrl = 'http://localhost:4002',
|
|
32
29
|
companyId = 1,
|
|
33
30
|
installGate = false,
|
|
34
31
|
installGuardian = false,
|
|
@@ -78,9 +75,7 @@ SOCKET_URL=${socketUrl}
|
|
|
78
75
|
# ------------------------------------------------------------------------------
|
|
79
76
|
# PORT CONFIGURATION
|
|
80
77
|
# ------------------------------------------------------------------------------
|
|
81
|
-
FRONTEND_PORT=${frontendPort}
|
|
82
78
|
BACKEND_PORT=${backendPort}
|
|
83
|
-
BACKEND_CORE_PORT=${backendCorePort}
|
|
84
79
|
FRONTEND_CORE_PORT=${frontendCorePort}
|
|
85
80
|
FRONTEND_CORE_MOBILE_PORT=${frontendCoreMobilePort}
|
|
86
81
|
${installMlm ? `BACKEND_MLM_PORT=${backendMlmPort}` : '# BACKEND_MLM_PORT=4001'}
|
|
@@ -89,18 +84,15 @@ ${installGuardian ? `GUARDIAN_APP_PORT=${guardianAppPort}` : '# GUARDIAN_APP_POR
|
|
|
89
84
|
${installFacial ? `FACIAL_WEB_PORT=${facialWebPort}` : '# FACIAL_WEB_PORT=8083'}
|
|
90
85
|
${installPos ? `POS_APP_PORT=${posAppPort}` : '# POS_APP_PORT=8084'}
|
|
91
86
|
${installMlm ? `MLM_APP_PORT=${mlmAppPort}` : '# MLM_APP_PORT=9005'}
|
|
92
|
-
# Note: WebSocket runs on the same port as backend (BACKEND_PORT)
|
|
93
87
|
|
|
94
88
|
# ------------------------------------------------------------------------------
|
|
95
|
-
#
|
|
89
|
+
# FRONTEND CONFIGURATION
|
|
96
90
|
# ------------------------------------------------------------------------------
|
|
97
91
|
FRONTEND_CORE_URL=${frontendCoreUrl}
|
|
98
92
|
FRONTEND_CORE_MOBILE_URL=${frontendCoreMobileUrl}
|
|
99
|
-
BACKEND_CORE_URL=${backendCoreUrl}
|
|
100
|
-
CORE_API_URL=${backendCoreUrl}
|
|
101
93
|
|
|
102
94
|
${(installGate || installGuardian || installFacial || installPos || installMlm) ? `# ------------------------------------------------------------------------------
|
|
103
|
-
#
|
|
95
|
+
# OPTIONAL APP CONFIGURATION
|
|
104
96
|
# ------------------------------------------------------------------------------
|
|
105
97
|
COMPANY_ID=${companyId}
|
|
106
98
|
${installGate ? `GATE_APP_URL=${gateAppUrl}` : '# GATE_APP_URL=http://localhost:8081'}
|
|
@@ -149,4 +141,3 @@ AUTO_MIGRATE=true
|
|
|
149
141
|
# ==============================================================================
|
|
150
142
|
`;
|
|
151
143
|
}
|
|
152
|
-
|
|
@@ -17819,21 +17819,21 @@ ALTER TABLE public."UserLevel" ENABLE ROW LEVEL SECURITY;
|
|
|
17819
17819
|
-- Name: CalendarCategory Users can create calendar categories for their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17820
17820
|
--
|
|
17821
17821
|
|
|
17822
|
-
CREATE POLICY "Users can create calendar categories for their company" ON public."CalendarCategory" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17822
|
+
CREATE POLICY "Users can create calendar categories for their company" ON public."CalendarCategory" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND ("companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)) AND ("isSystem" = false)));
|
|
17823
17823
|
|
|
17824
17824
|
|
|
17825
17825
|
--
|
|
17826
17826
|
-- Name: CalendarEvent Users can create calendar events for their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17827
17827
|
--
|
|
17828
17828
|
|
|
17829
|
-
CREATE POLICY "Users can create calendar events for their company" ON public."CalendarEvent" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17829
|
+
CREATE POLICY "Users can create calendar events for their company" ON public."CalendarEvent" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND ("companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)) AND ("creatorId" = (auth.jwt() ->> 'sub'::text))));
|
|
17830
17830
|
|
|
17831
17831
|
|
|
17832
17832
|
--
|
|
17833
17833
|
-- Name: CalendarEventAttachment Users can create event attachments for their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17834
17834
|
--
|
|
17835
17835
|
|
|
17836
|
-
CREATE POLICY "Users can create event attachments for their company" ON public."CalendarEventAttachment" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17836
|
+
CREATE POLICY "Users can create event attachments for their company" ON public."CalendarEventAttachment" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17837
17837
|
FROM public."CalendarEvent"
|
|
17838
17838
|
WHERE (("CalendarEvent".id = "CalendarEventAttachment"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17839
17839
|
|
|
@@ -17842,7 +17842,7 @@ CREATE POLICY "Users can create event attachments for their company" ON public."
|
|
|
17842
17842
|
-- Name: CalendarEventAttendee Users can create event attendees for their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17843
17843
|
--
|
|
17844
17844
|
|
|
17845
|
-
CREATE POLICY "Users can create event attendees for their company" ON public."CalendarEventAttendee" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17845
|
+
CREATE POLICY "Users can create event attendees for their company" ON public."CalendarEventAttendee" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17846
17846
|
FROM public."CalendarEvent"
|
|
17847
17847
|
WHERE (("CalendarEvent".id = "CalendarEventAttendee"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17848
17848
|
|
|
@@ -17851,7 +17851,7 @@ CREATE POLICY "Users can create event attendees for their company" ON public."Ca
|
|
|
17851
17851
|
-- Name: CalendarEventInstance Users can create event instances for their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17852
17852
|
--
|
|
17853
17853
|
|
|
17854
|
-
CREATE POLICY "Users can create event instances for their company" ON public."CalendarEventInstance" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17854
|
+
CREATE POLICY "Users can create event instances for their company" ON public."CalendarEventInstance" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17855
17855
|
FROM public."CalendarEvent"
|
|
17856
17856
|
WHERE (("CalendarEvent".id = "CalendarEventInstance"."parentEventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17857
17857
|
|
|
@@ -17860,7 +17860,7 @@ CREATE POLICY "Users can create event instances for their company" ON public."Ca
|
|
|
17860
17860
|
-- Name: CalendarEventRecurrence Users can create event recurrence for their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17861
17861
|
--
|
|
17862
17862
|
|
|
17863
|
-
CREATE POLICY "Users can create event recurrence for their company" ON public."CalendarEventRecurrence" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17863
|
+
CREATE POLICY "Users can create event recurrence for their company" ON public."CalendarEventRecurrence" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17864
17864
|
FROM public."CalendarEvent"
|
|
17865
17865
|
WHERE (("CalendarEvent".id = "CalendarEventRecurrence"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17866
17866
|
|
|
@@ -17869,7 +17869,7 @@ CREATE POLICY "Users can create event recurrence for their company" ON public."C
|
|
|
17869
17869
|
-- Name: CalendarEventReminder Users can create event reminders for their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17870
17870
|
--
|
|
17871
17871
|
|
|
17872
|
-
CREATE POLICY "Users can create event reminders for their company" ON public."CalendarEventReminder" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17872
|
+
CREATE POLICY "Users can create event reminders for their company" ON public."CalendarEventReminder" FOR INSERT TO authenticated WITH CHECK (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17873
17873
|
FROM public."CalendarEvent"
|
|
17874
17874
|
WHERE (("CalendarEvent".id = "CalendarEventReminder"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17875
17875
|
|
|
@@ -17878,21 +17878,21 @@ CREATE POLICY "Users can create event reminders for their company" ON public."Ca
|
|
|
17878
17878
|
-- Name: CalendarCategory Users can delete calendar categories from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17879
17879
|
--
|
|
17880
17880
|
|
|
17881
|
-
CREATE POLICY "Users can delete calendar categories from their company" ON public."CalendarCategory" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17881
|
+
CREATE POLICY "Users can delete calendar categories from their company" ON public."CalendarCategory" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND ("companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)) AND ("isSystem" = false)));
|
|
17882
17882
|
|
|
17883
17883
|
|
|
17884
17884
|
--
|
|
17885
17885
|
-- Name: CalendarEvent Users can delete calendar events from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17886
17886
|
--
|
|
17887
17887
|
|
|
17888
|
-
CREATE POLICY "Users can delete calendar events from their company" ON public."CalendarEvent" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17888
|
+
CREATE POLICY "Users can delete calendar events from their company" ON public."CalendarEvent" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND ("companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)) AND ("creatorId" = (auth.jwt() ->> 'sub'::text))));
|
|
17889
17889
|
|
|
17890
17890
|
|
|
17891
17891
|
--
|
|
17892
17892
|
-- Name: CalendarEventAttachment Users can delete event attachments from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17893
17893
|
--
|
|
17894
17894
|
|
|
17895
|
-
CREATE POLICY "Users can delete event attachments from their company" ON public."CalendarEventAttachment" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17895
|
+
CREATE POLICY "Users can delete event attachments from their company" ON public."CalendarEventAttachment" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17896
17896
|
FROM public."CalendarEvent"
|
|
17897
17897
|
WHERE (("CalendarEvent".id = "CalendarEventAttachment"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17898
17898
|
|
|
@@ -17901,7 +17901,7 @@ CREATE POLICY "Users can delete event attachments from their company" ON public.
|
|
|
17901
17901
|
-- Name: CalendarEventAttendee Users can delete event attendees from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17902
17902
|
--
|
|
17903
17903
|
|
|
17904
|
-
CREATE POLICY "Users can delete event attendees from their company" ON public."CalendarEventAttendee" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17904
|
+
CREATE POLICY "Users can delete event attendees from their company" ON public."CalendarEventAttendee" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17905
17905
|
FROM public."CalendarEvent"
|
|
17906
17906
|
WHERE (("CalendarEvent".id = "CalendarEventAttendee"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17907
17907
|
|
|
@@ -17910,7 +17910,7 @@ CREATE POLICY "Users can delete event attendees from their company" ON public."C
|
|
|
17910
17910
|
-- Name: CalendarEventInstance Users can delete event instances from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17911
17911
|
--
|
|
17912
17912
|
|
|
17913
|
-
CREATE POLICY "Users can delete event instances from their company" ON public."CalendarEventInstance" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17913
|
+
CREATE POLICY "Users can delete event instances from their company" ON public."CalendarEventInstance" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17914
17914
|
FROM public."CalendarEvent"
|
|
17915
17915
|
WHERE (("CalendarEvent".id = "CalendarEventInstance"."parentEventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17916
17916
|
|
|
@@ -17919,7 +17919,7 @@ CREATE POLICY "Users can delete event instances from their company" ON public."C
|
|
|
17919
17919
|
-- Name: CalendarEventRecurrence Users can delete event recurrence from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17920
17920
|
--
|
|
17921
17921
|
|
|
17922
|
-
CREATE POLICY "Users can delete event recurrence from their company" ON public."CalendarEventRecurrence" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17922
|
+
CREATE POLICY "Users can delete event recurrence from their company" ON public."CalendarEventRecurrence" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17923
17923
|
FROM public."CalendarEvent"
|
|
17924
17924
|
WHERE (("CalendarEvent".id = "CalendarEventRecurrence"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17925
17925
|
|
|
@@ -17928,7 +17928,7 @@ CREATE POLICY "Users can delete event recurrence from their company" ON public."
|
|
|
17928
17928
|
-- Name: CalendarEventReminder Users can delete event reminders from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17929
17929
|
--
|
|
17930
17930
|
|
|
17931
|
-
CREATE POLICY "Users can delete event reminders from their company" ON public."CalendarEventReminder" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17931
|
+
CREATE POLICY "Users can delete event reminders from their company" ON public."CalendarEventReminder" FOR DELETE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17932
17932
|
FROM public."CalendarEvent"
|
|
17933
17933
|
WHERE (("CalendarEvent".id = "CalendarEventReminder"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17934
17934
|
|
|
@@ -17937,21 +17937,21 @@ CREATE POLICY "Users can delete event reminders from their company" ON public."C
|
|
|
17937
17937
|
-- Name: CalendarCategory Users can update calendar categories from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17938
17938
|
--
|
|
17939
17939
|
|
|
17940
|
-
CREATE POLICY "Users can update calendar categories from their company" ON public."CalendarCategory" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17940
|
+
CREATE POLICY "Users can update calendar categories from their company" ON public."CalendarCategory" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND ("companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)) AND ("isSystem" = false))) WITH CHECK ((("companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)) AND ("isSystem" = false)));
|
|
17941
17941
|
|
|
17942
17942
|
|
|
17943
17943
|
--
|
|
17944
17944
|
-- Name: CalendarEvent Users can update calendar events from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17945
17945
|
--
|
|
17946
17946
|
|
|
17947
|
-
CREATE POLICY "Users can update calendar events from their company" ON public."CalendarEvent" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17947
|
+
CREATE POLICY "Users can update calendar events from their company" ON public."CalendarEvent" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND ("companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))) WITH CHECK (("companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)));
|
|
17948
17948
|
|
|
17949
17949
|
|
|
17950
17950
|
--
|
|
17951
17951
|
-- Name: CalendarEventAttachment Users can update event attachments from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17952
17952
|
--
|
|
17953
17953
|
|
|
17954
|
-
CREATE POLICY "Users can update event attachments from their company" ON public."CalendarEventAttachment" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17954
|
+
CREATE POLICY "Users can update event attachments from their company" ON public."CalendarEventAttachment" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17955
17955
|
FROM public."CalendarEvent"
|
|
17956
17956
|
WHERE (("CalendarEvent".id = "CalendarEventAttachment"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17957
17957
|
|
|
@@ -17960,7 +17960,7 @@ CREATE POLICY "Users can update event attachments from their company" ON public.
|
|
|
17960
17960
|
-- Name: CalendarEventAttendee Users can update event attendees from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17961
17961
|
--
|
|
17962
17962
|
|
|
17963
|
-
CREATE POLICY "Users can update event attendees from their company" ON public."CalendarEventAttendee" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17963
|
+
CREATE POLICY "Users can update event attendees from their company" ON public."CalendarEventAttendee" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17964
17964
|
FROM public."CalendarEvent"
|
|
17965
17965
|
WHERE (("CalendarEvent".id = "CalendarEventAttendee"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17966
17966
|
|
|
@@ -17969,7 +17969,7 @@ CREATE POLICY "Users can update event attendees from their company" ON public."C
|
|
|
17969
17969
|
-- Name: CalendarEventInstance Users can update event instances from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17970
17970
|
--
|
|
17971
17971
|
|
|
17972
|
-
CREATE POLICY "Users can update event instances from their company" ON public."CalendarEventInstance" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17972
|
+
CREATE POLICY "Users can update event instances from their company" ON public."CalendarEventInstance" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17973
17973
|
FROM public."CalendarEvent"
|
|
17974
17974
|
WHERE (("CalendarEvent".id = "CalendarEventInstance"."parentEventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17975
17975
|
|
|
@@ -17978,7 +17978,7 @@ CREATE POLICY "Users can update event instances from their company" ON public."C
|
|
|
17978
17978
|
-- Name: CalendarEventRecurrence Users can update event recurrence from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17979
17979
|
--
|
|
17980
17980
|
|
|
17981
|
-
CREATE POLICY "Users can update event recurrence from their company" ON public."CalendarEventRecurrence" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17981
|
+
CREATE POLICY "Users can update event recurrence from their company" ON public."CalendarEventRecurrence" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17982
17982
|
FROM public."CalendarEvent"
|
|
17983
17983
|
WHERE (("CalendarEvent".id = "CalendarEventRecurrence"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17984
17984
|
|
|
@@ -17987,7 +17987,7 @@ CREATE POLICY "Users can update event recurrence from their company" ON public."
|
|
|
17987
17987
|
-- Name: CalendarEventReminder Users can update event reminders from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17988
17988
|
--
|
|
17989
17989
|
|
|
17990
|
-
CREATE POLICY "Users can update event reminders from their company" ON public."CalendarEventReminder" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17990
|
+
CREATE POLICY "Users can update event reminders from their company" ON public."CalendarEventReminder" FOR UPDATE TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
17991
17991
|
FROM public."CalendarEvent"
|
|
17992
17992
|
WHERE (("CalendarEvent".id = "CalendarEventReminder"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
17993
17993
|
|
|
@@ -17996,21 +17996,21 @@ CREATE POLICY "Users can update event reminders from their company" ON public."C
|
|
|
17996
17996
|
-- Name: CalendarCategory Users can view calendar categories from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
17997
17997
|
--
|
|
17998
17998
|
|
|
17999
|
-
CREATE POLICY "Users can view calendar categories from their company" ON public."CalendarCategory" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
17999
|
+
CREATE POLICY "Users can view calendar categories from their company" ON public."CalendarCategory" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND ("companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0))));
|
|
18000
18000
|
|
|
18001
18001
|
|
|
18002
18002
|
--
|
|
18003
18003
|
-- Name: CalendarEvent Users can view calendar events from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
18004
18004
|
--
|
|
18005
18005
|
|
|
18006
|
-
CREATE POLICY "Users can view calendar events from their company" ON public."CalendarEvent" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
18006
|
+
CREATE POLICY "Users can view calendar events from their company" ON public."CalendarEvent" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND ("companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0))));
|
|
18007
18007
|
|
|
18008
18008
|
|
|
18009
18009
|
--
|
|
18010
18010
|
-- Name: CalendarEventAttachment Users can view event attachments from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
18011
18011
|
--
|
|
18012
18012
|
|
|
18013
|
-
CREATE POLICY "Users can view event attachments from their company" ON public."CalendarEventAttachment" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
18013
|
+
CREATE POLICY "Users can view event attachments from their company" ON public."CalendarEventAttachment" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
18014
18014
|
FROM public."CalendarEvent"
|
|
18015
18015
|
WHERE (("CalendarEvent".id = "CalendarEventAttachment"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
18016
18016
|
|
|
@@ -18019,7 +18019,7 @@ CREATE POLICY "Users can view event attachments from their company" ON public."C
|
|
|
18019
18019
|
-- Name: CalendarEventAttendee Users can view event attendees from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
18020
18020
|
--
|
|
18021
18021
|
|
|
18022
|
-
CREATE POLICY "Users can view event attendees from their company" ON public."CalendarEventAttendee" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
18022
|
+
CREATE POLICY "Users can view event attendees from their company" ON public."CalendarEventAttendee" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
18023
18023
|
FROM public."CalendarEvent"
|
|
18024
18024
|
WHERE (("CalendarEvent".id = "CalendarEventAttendee"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
18025
18025
|
|
|
@@ -18028,7 +18028,7 @@ CREATE POLICY "Users can view event attendees from their company" ON public."Cal
|
|
|
18028
18028
|
-- Name: CalendarEventInstance Users can view event instances from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
18029
18029
|
--
|
|
18030
18030
|
|
|
18031
|
-
CREATE POLICY "Users can view event instances from their company" ON public."CalendarEventInstance" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
18031
|
+
CREATE POLICY "Users can view event instances from their company" ON public."CalendarEventInstance" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
18032
18032
|
FROM public."CalendarEvent"
|
|
18033
18033
|
WHERE (("CalendarEvent".id = "CalendarEventInstance"."parentEventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
18034
18034
|
|
|
@@ -18037,7 +18037,7 @@ CREATE POLICY "Users can view event instances from their company" ON public."Cal
|
|
|
18037
18037
|
-- Name: CalendarEventRecurrence Users can view event recurrence from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
18038
18038
|
--
|
|
18039
18039
|
|
|
18040
|
-
CREATE POLICY "Users can view event recurrence from their company" ON public."CalendarEventRecurrence" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
18040
|
+
CREATE POLICY "Users can view event recurrence from their company" ON public."CalendarEventRecurrence" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
18041
18041
|
FROM public."CalendarEvent"
|
|
18042
18042
|
WHERE (("CalendarEvent".id = "CalendarEventRecurrence"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
18043
18043
|
|
|
@@ -18046,7 +18046,7 @@ CREATE POLICY "Users can view event recurrence from their company" ON public."Ca
|
|
|
18046
18046
|
-- Name: CalendarEventReminder Users can view event reminders from their company; Type: POLICY; Schema: public; Owner: postgres
|
|
18047
18047
|
--
|
|
18048
18048
|
|
|
18049
|
-
CREATE POLICY "Users can view event reminders from their company" ON public."CalendarEventReminder" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-
|
|
18049
|
+
CREATE POLICY "Users can view event reminders from their company" ON public."CalendarEventReminder" FOR SELECT TO authenticated USING (((((current_setting('request.headers'::text, true))::json ->> 'x-source'::text) = 'frontend-core'::text) AND (EXISTS ( SELECT 1
|
|
18050
18050
|
FROM public."CalendarEvent"
|
|
18051
18051
|
WHERE (("CalendarEvent".id = "CalendarEventReminder"."eventId") AND ("CalendarEvent"."companyId" = COALESCE((((auth.jwt() -> 'user_metadata'::text) ->> 'companyId'::text))::integer, 0)))))));
|
|
18052
18052
|
|
package/src/utils/nginx.js
CHANGED
|
@@ -57,7 +57,7 @@ export async function installNginx(spinner) {
|
|
|
57
57
|
* @param {string} [config.frontendCoreDomain] - Frontend Core app domain (optional)
|
|
58
58
|
* @param {string} [config.frontendCoreMobileDomain] - Frontend Core Mobile app domain (optional)
|
|
59
59
|
* @param {string} [config.backendCoreDomain] - Backend Core API domain (optional)
|
|
60
|
-
* @param {number} config.frontendPort - Frontend Docker port (default:
|
|
60
|
+
* @param {number} config.frontendPort - Frontend Docker port (default: 8085)
|
|
61
61
|
* @param {number} config.apiPort - API Docker port (default: 3001)
|
|
62
62
|
* @param {number} [config.gateAppPort] - Gate app Docker port (default: 8081)
|
|
63
63
|
* @param {number} [config.guardianAppPort] - Guardian app Docker port (default: 8082)
|
|
@@ -85,7 +85,7 @@ export function generateNginxConfig(config) {
|
|
|
85
85
|
frontendCoreDomain,
|
|
86
86
|
frontendCoreMobileDomain,
|
|
87
87
|
backendCoreDomain,
|
|
88
|
-
frontendPort =
|
|
88
|
+
frontendPort = 8085,
|
|
89
89
|
apiPort = 3001,
|
|
90
90
|
gateAppPort = 8081,
|
|
91
91
|
guardianAppPort = 8082,
|
|
@@ -1725,7 +1725,7 @@ server {
|
|
|
1725
1725
|
* @param {Object} config - Configuration object
|
|
1726
1726
|
* @param {string} config.frontendDomain - Frontend domain
|
|
1727
1727
|
* @param {string} config.apiDomain - API domain
|
|
1728
|
-
* @param {number} [config.frontendPort=
|
|
1728
|
+
* @param {number} [config.frontendPort=8085] - Frontend Docker port
|
|
1729
1729
|
* @param {number} [config.apiPort=3001] - API Docker port
|
|
1730
1730
|
* @returns {Promise<void>}
|
|
1731
1731
|
*/
|
|
@@ -1798,7 +1798,7 @@ export async function configureNginx(config) {
|
|
|
1798
1798
|
// Show helpful information
|
|
1799
1799
|
console.log(chalk.gray('\nš NGINX Configuration:'));
|
|
1800
1800
|
console.log(chalk.gray(` Config file: ${configPath}`));
|
|
1801
|
-
console.log(chalk.gray(` Frontend: ${config.frontendDomain} ā localhost:${config.frontendPort ||
|
|
1801
|
+
console.log(chalk.gray(` Frontend: ${config.frontendDomain} ā localhost:${config.frontendPort || 8085}`));
|
|
1802
1802
|
if (config.gateAppDomain) {
|
|
1803
1803
|
console.log(chalk.gray(` Gate App: ${config.gateAppDomain} ā localhost:${config.gateAppPort || 8081}`));
|
|
1804
1804
|
}
|
package/src/utils/ssl.js
CHANGED
|
@@ -144,7 +144,7 @@ export async function obtainSSLCertificate(config) {
|
|
|
144
144
|
* @param {string} [config.frontendCoreDomain] - Frontend Core domain URL (optional)
|
|
145
145
|
* @param {string} [config.frontendCoreMobileDomain] - Frontend Core Mobile domain URL (optional)
|
|
146
146
|
* @param {string} [config.backendCoreDomain] - Backend Core API domain URL (optional)
|
|
147
|
-
* @param {number} [config.frontendPort=
|
|
147
|
+
* @param {number} [config.frontendPort=8085] - Frontend port
|
|
148
148
|
* @param {number} [config.apiPort=3001] - API port
|
|
149
149
|
* @param {number} [config.gateAppPort=8081] - Gate App port
|
|
150
150
|
* @param {number} [config.guardianAppPort=8082] - Guardian App port
|
|
@@ -171,7 +171,7 @@ export async function updateNginxForSSL(config) {
|
|
|
171
171
|
frontendCoreDomain,
|
|
172
172
|
frontendCoreMobileDomain,
|
|
173
173
|
backendCoreDomain,
|
|
174
|
-
frontendPort =
|
|
174
|
+
frontendPort = 8085,
|
|
175
175
|
apiPort = 3001,
|
|
176
176
|
gateAppPort = 8081,
|
|
177
177
|
guardianAppPort = 8082,
|
package/src/utils/validation.js
CHANGED
|
@@ -229,7 +229,7 @@ export async function checkPort(port) {
|
|
|
229
229
|
*/
|
|
230
230
|
function detectPortsFromEnv(installDir = './ante-erp') {
|
|
231
231
|
// Default ports now include core services (always included)
|
|
232
|
-
const defaultPorts = [
|
|
232
|
+
const defaultPorts = [3001, 4001, 8085, 8086];
|
|
233
233
|
|
|
234
234
|
try {
|
|
235
235
|
const envPath = join(installDir, '.env');
|