init
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/// modules/center/dto.js
|
||||
const { toAbsoluteUrl } = require('../../utils/url');
|
||||
|
||||
const toDto = (row) => ({
|
||||
id: row.id,
|
||||
name: row.name,
|
||||
slug: row.slug,
|
||||
icon: row.icon || '',
|
||||
iconImage: toAbsoluteUrl(row.icon_image || ''),
|
||||
intro: row.intro || '',
|
||||
image: toAbsoluteUrl(row.image || ''),
|
||||
sort: Number(row.sort || 0),
|
||||
enabled: row.enabled === 1 || row.enabled === true,
|
||||
createdAt: row.created_at
|
||||
});
|
||||
|
||||
const toCreateDto = (body) => ({
|
||||
name: body.name,
|
||||
slug: body.slug,
|
||||
icon: body.icon,
|
||||
iconImage: body.iconImage,
|
||||
intro: body.intro,
|
||||
image: body.image,
|
||||
sort: body.sort,
|
||||
enabled: body.enabled
|
||||
});
|
||||
|
||||
module.exports = { toDto, toCreateDto };
|
||||
Reference in New Issue
Block a user