260322:1648 Correct Coresspondence / Doing RFA / Correct CI
CI Pipeline / build (push) Failing after 12m41s
Build and Deploy / deploy (push) Failing after 2m44s

This commit is contained in:
admin
2026-03-22 16:48:12 +07:00
parent e5deedb42e
commit 11984bfa29
683 changed files with 105251 additions and 29068 deletions
+32 -31
View File
@@ -4,49 +4,50 @@ import * as fs from 'fs';
// Read .env to get DB config
const envFile = fs.readFileSync('.env', 'utf8');
const getEnv = (key: string) => {
const line = envFile.split('\n').find(l => l.startsWith(key + '='));
return line ? line.split('=')[1].trim() : '';
const line = envFile.split('\n').find((l) => l.startsWith(key + '='));
return line ? line.split('=')[1].trim() : '';
};
const dataSource = new DataSource({
type: 'mariadb',
host: getEnv('DB_HOST') || 'localhost',
port: parseInt(getEnv('DB_PORT') || '3306'),
username: getEnv('DB_USERNAME') || 'admin',
password: getEnv('DB_PASSWORD') || 'Center2025',
database: getEnv('DB_DATABASE') || 'lcbp3_dev',
entities: [],
synchronize: false,
type: 'mariadb',
host: getEnv('DB_HOST') || 'localhost',
port: parseInt(getEnv('DB_PORT') || '3306'),
username: getEnv('DB_USERNAME') || 'admin',
password: getEnv('DB_PASSWORD') || 'Center2025',
database: getEnv('DB_DATABASE') || 'lcbp3_dev',
entities: [],
synchronize: false,
});
async function main() {
await dataSource.initialize();
console.log('Connected to DB');
await dataSource.initialize();
console.log('Connected to DB');
try {
const assignments = await dataSource.query('SELECT * FROM user_assignments');
console.log('All Assignments:', assignments);
try {
const assignments = await dataSource.query(
'SELECT * FROM user_assignments'
);
console.log('All Assignments:', assignments);
// Check if User 3 has any assignment
const user3Assign = assignments.find((a: any) => a.user_id === 3);
if (!user3Assign) {
console.log('User 3 has NO assignments.');
// Try to insert assignment for User 3 (Editor)
console.log('Inserting assignment for User 3 (Role 4, Org 41)...');
await dataSource.query(`
// Check if User 3 has any assignment
const user3Assign = assignments.find((a: any) => a.user_id === 3);
if (!user3Assign) {
console.log('User 3 has NO assignments.');
// Try to insert assignment for User 3 (Editor)
console.log('Inserting assignment for User 3 (Role 4, Org 41)...');
await dataSource.query(`
INSERT INTO user_assignments (user_id, role_id, organization_id, assigned_by_user_id)
VALUES (3, 4, 41, 1)
`);
console.log('Inserted assignment for User 3.');
} else {
console.log('User 3 Assignment:', user3Assign);
}
} catch (err) {
console.error(err);
} finally {
await dataSource.destroy();
console.log('Inserted assignment for User 3.');
} else {
console.log('User 3 Assignment:', user3Assign);
}
} catch (err) {
console.error(err);
} finally {
await dataSource.destroy();
}
}
main();
+8 -8
View File
@@ -9,10 +9,10 @@ const API_URL = 'http://localhost:3000/api';
function signJwt(payload: any) {
const header = { alg: 'HS256', typ: 'JWT' };
const encodedHeader = Buffer.from(JSON.stringify(header)).toString(
'base64url',
'base64url'
);
const encodedPayload = Buffer.from(JSON.stringify(payload)).toString(
'base64url',
'base64url'
);
const signature = crypto
@@ -44,7 +44,7 @@ async function main() {
console.error(
'Failed to get permissions:',
permRes.status,
await permRes.text(),
await permRes.text()
);
}
@@ -64,7 +64,7 @@ async function main() {
if (!createRes.ok) {
throw new Error(
`Create failed: ${createRes.status} ${await createRes.text()}`,
`Create failed: ${createRes.status} ${await createRes.text()}`
);
}
@@ -81,7 +81,7 @@ async function main() {
body: JSON.stringify({
templateId: 1, // Assuming Template ID 1 exists
}),
},
}
);
if (!submitRes.ok) {
@@ -89,7 +89,7 @@ async function main() {
console.error(`Submit failed: ${submitRes.status} ${text}`);
if (text.includes('template')) {
console.warn(
'⚠️ Template ID 1 not found. Please ensure a Routing Template exists.',
'⚠️ Template ID 1 not found. Please ensure a Routing Template exists.'
);
}
return;
@@ -108,12 +108,12 @@ async function main() {
action: 'APPROVE',
comment: 'Approved via script',
}),
},
}
);
if (!approveRes.ok) {
throw new Error(
`Approve failed: ${approveRes.status} ${await approveRes.text()}`,
`Approve failed: ${approveRes.status} ${await approveRes.text()}`
);
}