init
This commit is contained in:
22
app/controllers/brands_controller.js
Normal file
22
app/controllers/brands_controller.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import BrandColor from '#models/brand_color';
|
||||
import BrandFont from '#models/brand_font';
|
||||
export default class BrandsController {
|
||||
async show({}) {
|
||||
const colors = await BrandColor.all();
|
||||
const fonts = await BrandFont.all();
|
||||
return { colors, fonts };
|
||||
}
|
||||
async update({ request }) {
|
||||
const { colors, fonts } = request.only(['colors', 'fonts']);
|
||||
if (colors) {
|
||||
await BrandColor.truncate();
|
||||
await BrandColor.createMany(colors);
|
||||
}
|
||||
if (fonts) {
|
||||
await BrandFont.truncate();
|
||||
await BrandFont.createMany(fonts);
|
||||
}
|
||||
return this.show({ request });
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=brands_controller.js.map
|
||||
Reference in New Issue
Block a user