Updates
This commit is contained in:
@@ -20,7 +20,7 @@ export default function grabDirNames(param?: Param) {
|
||||
|
||||
const pakageSharedDir = path.join(appDir, `package-shared`);
|
||||
|
||||
const mainDbTypeDefFile = path.join(appDir, `types/dsql.ts`);
|
||||
const mainDbTypeDefFile = path.join(pakageSharedDir, `types/dsql.ts`);
|
||||
const mainShemaJSONFilePath = path.join(schemasDir, `main.json`);
|
||||
const defaultTableFieldsJSONFilePath = path.join(
|
||||
pakageSharedDir,
|
||||
@@ -57,6 +57,11 @@ export default function grabDirNames(param?: Param) {
|
||||
? path.join(userPrivateSQLExportsDir, userPrivateDbExportZipFileName)
|
||||
: undefined;
|
||||
|
||||
const userPrivateDbImportZipFileName = `db-export.zip`;
|
||||
const userPrivateDbImportZipFilePath = userPrivateSQLExportsDir
|
||||
? path.join(userPrivateSQLExportsDir, userPrivateDbImportZipFileName)
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
schemasDir,
|
||||
userDirPath,
|
||||
@@ -73,5 +78,7 @@ export default function grabDirNames(param?: Param) {
|
||||
userPrivateTempJSONSchemaFilePath,
|
||||
userPrivateDbExportZipFileName,
|
||||
userPrivateDbExportZipFilePath,
|
||||
userPrivateDbImportZipFileName,
|
||||
userPrivateDbImportZipFilePath,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
type Param = {
|
||||
str: string;
|
||||
userId: string | number;
|
||||
};
|
||||
export default function replaceDatasquirelDbName({
|
||||
str,
|
||||
userId,
|
||||
}: Param): string {
|
||||
const dbNamePrefix = process.env.DSQL_USER_DB_PREFIX;
|
||||
const userNameRegex = new RegExp(`${dbNamePrefix}\\d+_`, "g");
|
||||
const newPrefix = `${dbNamePrefix}${userId}_`;
|
||||
|
||||
return str.replace(userNameRegex, newPrefix);
|
||||
}
|
||||
Reference in New Issue
Block a user