2018-05-13 06:14:06 +00:00
|
|
|
// @flow
|
2020-06-20 20:59:15 +00:00
|
|
|
import { Share } from "../models";
|
|
|
|
import { presentUser } from ".";
|
2018-05-13 06:14:06 +00:00
|
|
|
|
2021-04-18 16:38:13 +00:00
|
|
|
export default function present(share: Share, isAdmin: boolean = false) {
|
|
|
|
let data = {
|
2018-05-13 06:14:06 +00:00
|
|
|
id: share.id,
|
2020-07-29 02:14:32 +00:00
|
|
|
documentId: share.documentId,
|
2018-05-13 06:14:06 +00:00
|
|
|
documentTitle: share.document.title,
|
2018-11-04 07:59:52 +00:00
|
|
|
documentUrl: share.document.url,
|
2020-07-29 02:14:32 +00:00
|
|
|
published: share.published,
|
|
|
|
url: `${share.team.url}/share/${share.id}`,
|
2019-04-18 02:11:23 +00:00
|
|
|
createdBy: presentUser(share.user),
|
2021-05-23 02:34:05 +00:00
|
|
|
includeChildDocuments: share.includeChildDocuments,
|
2021-04-18 16:38:13 +00:00
|
|
|
lastAccessedAt: share.lastAccessedAt,
|
2018-05-13 06:14:06 +00:00
|
|
|
createdAt: share.createdAt,
|
|
|
|
updatedAt: share.updatedAt,
|
|
|
|
};
|
2021-04-18 16:38:13 +00:00
|
|
|
|
|
|
|
if (!isAdmin) {
|
|
|
|
delete data.lastAccessedAt;
|
|
|
|
}
|
|
|
|
|
|
|
|
return data;
|
2018-05-13 06:14:06 +00:00
|
|
|
}
|