Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async () => {
Entity.driver = new MySQLDriver({ connection });
const authentication = new Authentication({
identities: [{ identity: User }]
});
// Configure default storage
const localDriver = new LocalDriver({
directory: __dirname + "/storage",
createDatePrefix: false,
publicUrl: "https://cdn.domain.com"
});
const storage = new Storage(localDriver);
// Register attributes
registerSecurityAttributes(authentication);
registerBufferAttribute();
registerFileAttributes({ entity: File, storage });
registerImageAttributes({ entity: Image });
console.log("Importing data...");
for (let i = 0; i < importData.length; i++) {
const { entity, data } = await importData[i]();
for (let j = 0; j < data.length; j++) {
const obj = data[j];
const instance = new entity();
try {
instance.populate(obj);
await instance.save();
export default async () => {
Entity.driver = new MySQLDriver({ connection });
const authentication = new Authentication({
identities: [{ identity: User }]
});
// Configure default storage
const localDriver = new LocalDriver({
directory: __dirname + "/storage",
createDatePrefix: false,
publicUrl: "https://cdn.domain.com"
});
const storage = new Storage(localDriver);
// Register attributes
registerSecurityAttributes(authentication);
registerBufferAttribute();
registerFileAttributes({ entity: File, storage });
registerImageAttributes({ entity: Image });
console.log("Importing data...");
for (let i = 0; i < importData.length; i++) {
const { entity, data } = await importData[i]();
for (let j = 0; j < data.length; j++) {
const obj = data[j];
const instance = new entity();
try {
instance.populate(obj);
await instance.save();
attributes: ({
/* passwordAttribute,
identityAttribute,
bufferAttribute,*/
fileAttributes,
imageAttributes
}) => {
/* identityAttribute();
passwordAttribute();
bufferAttribute();*/
fileAttributes({
entity: File,
storage: new Storage(localDriver)
});
imageAttributes({
entity: Image,
processor: imageProcessor(),
quality: 90,
storage: new Storage(localDriver)
});
}
},
attributes: ({ bufferAttribute, fileAttributes, imageAttributes }) => {
bufferAttribute();
fileAttributes({
entity: File,
storage: new Storage(localDriver)
});
imageAttributes({
entity: Image,
processor: imageProcessor(),
quality: 90
});
}
}