"add admin user seed script and refactor common seed utilities"
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
module.exports = $app => {
|
||||
const ASSETS_DIR = '/pb_hooks/assets';
|
||||
const getAsset = name => $filesystem.fileFromPath(ASSETS_DIR + '/' + name);
|
||||
const config = require("/pb_hooks/seed/config.js");
|
||||
const utils = require("/pb_hooks/seed/utils.js");
|
||||
|
||||
module.exports = ($app) => {
|
||||
const { CR_cat_id_news, CR_cat_id_technology } = config;
|
||||
const { getId, getAsset, dirtyTruncateTable } = utils;
|
||||
// const ASSETS_DIR = "/pb_hooks/assets";
|
||||
// const getAsset = (name) => $filesystem.fileFromPath(ASSETS_DIR + "/" + name);
|
||||
|
||||
for (let i = 0; i < 3; i++) {
|
||||
let t1_collection = $app.findCollectionByNameOrId('t1');
|
||||
let t1_collection = $app.findCollectionByNameOrId("t1");
|
||||
|
||||
let record = new Record(t1_collection);
|
||||
record.set('hello', 'world');
|
||||
let test_png = getAsset('1.png');
|
||||
record.set('test_file', test_png);
|
||||
record.set("hello", "world");
|
||||
let test_png = getAsset("1.png");
|
||||
record.set("test_file", test_png);
|
||||
|
||||
$app.save(record);
|
||||
}
|
||||
|
Reference in New Issue
Block a user