Postgres.
This commit is contained in:
parent
695644c260
commit
806f42e3f8
25 changed files with 501 additions and 294 deletions
|
@ -22,15 +22,15 @@ export function formatSize(size) {
|
|||
|
||||
export function formatFile(file) {
|
||||
const formattedFile = {
|
||||
added: moment.unix(file.time_added).format(),
|
||||
readableAdded: formatDate(file.time_added),
|
||||
added: moment.unix(file.createdAt).format(),
|
||||
readableAdded: formatDate(file.createdAt),
|
||||
downloads: file.downloads !== undefined ? file.downloads : 0,
|
||||
href: `${baseURL}/${file._id}`,
|
||||
id: file._id,
|
||||
name: file.file_name,
|
||||
size: file.file_size,
|
||||
readableSize: formatSize(file.file_size),
|
||||
type: sniff(file.file_name),
|
||||
href: `${baseURL}/${file.id}`,
|
||||
id: file.id,
|
||||
name: file.name,
|
||||
size: file.size,
|
||||
readableSize: formatSize(file.size),
|
||||
type: sniff(file.name),
|
||||
trashed: (file.status === 'trashed'),
|
||||
status: file.status,
|
||||
};
|
||||
|
@ -38,10 +38,10 @@ export function formatFile(file) {
|
|||
if (file.width) {
|
||||
formattedFile.height = file.height;
|
||||
formattedFile.width = file.width;
|
||||
const ext = (file.file_name.split('.').pop().toLowerCase() === 'psd' ? '.png' : '');
|
||||
const ext = (file.name.split('.').pop().toLowerCase() === 'psd' ? '.png' : '');
|
||||
formattedFile.direct = {
|
||||
'150x': `${baseURL}/file/150/${file._id}/${file.file_name}${ext}`,
|
||||
'970x': `${baseURL}/file/970/${file._id}/${file.file_name}${ext}`,
|
||||
'150x': `${baseURL}/file/150/${file.id}/${file.name}${ext}`,
|
||||
'970x': `${baseURL}/file/970/${file.id}/${file.name}${ext}`,
|
||||
};
|
||||
}
|
||||
return formattedFile;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue