"add admin user seed script and refactor common seed utilities"
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
const config = require('/pb_hooks/seed/config.js');
|
||||
const config = require("/pb_hooks/seed/config.js");
|
||||
|
||||
module.exports = {
|
||||
getAsset: name => {
|
||||
const file_full_path = config.ASSETS_DIR + '/' + name;
|
||||
getAsset: (name) => {
|
||||
const file_full_path = config.ASSETS_DIR + "/" + name;
|
||||
try {
|
||||
return $filesystem.fileFromPath(file_full_path);
|
||||
} catch (error) {
|
||||
console.log('file not found: ' + file_full_path, +'please check if file exist');
|
||||
console.log("file not found: " + file_full_path, +"please check if file exist");
|
||||
}
|
||||
},
|
||||
getId: (id) => id.padStart(15, 0),
|
||||
|
||||
dirtyTruncateTable: (COLLECTION_NAME) => {
|
||||
console.log(`perform dirty method to truncate table "${COLLECTION_NAME}"`);
|
||||
const cmd_to_exec = $os.cmd("sqlite3", "/pb_data/data.db", `DELETE from ${COLLECTION_NAME};`);
|
||||
cmd_to_exec.output();
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user