20 lines
729 B
JavaScript
20 lines
729 B
JavaScript
|
|
const fs = require('fs');
|
||
|
|
const path = require('path');
|
||
|
|
|
||
|
|
const filePath = path.join(__dirname, 'src/api/routes/saas-tenant.ts');
|
||
|
|
let content = fs.readFileSync(filePath, 'utf8');
|
||
|
|
|
||
|
|
const patterns = [
|
||
|
|
{ pattern: /req\.params\.tenantId/g, replacement: 'req.params.tenantId as string' },
|
||
|
|
{ pattern: /req\.params\.domainId/g, replacement: 'req.params.domainId as string' },
|
||
|
|
{ pattern: /req\.params\.userId/g, replacement: 'req.params.userId as string' },
|
||
|
|
{ pattern: /req\.params\.roleId/g, replacement: 'req.params.roleId as string' },
|
||
|
|
];
|
||
|
|
|
||
|
|
patterns.forEach(({ pattern, replacement }) => {
|
||
|
|
content = content.replace(pattern, replacement);
|
||
|
|
});
|
||
|
|
|
||
|
|
fs.writeFileSync(filePath, content, 'utf8');
|
||
|
|
console.log('Fixed saas-tenant.ts');
|