Skip to content

Commit

Permalink
fix(files): change file-attribute to content
Browse files Browse the repository at this point in the history
  • Loading branch information
fugal-dy authored and anehx committed Dec 5, 2023
1 parent 816c8d2 commit d432404
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion addon/models/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ export default class DocumentModel extends LocalizedModel {
const thumbnail = this.files.filter(
(file) => file.variant === "thumbnail",
)[0];
return thumbnail && thumbnail.downloadUrl;
return thumbnail && thumbnail.content;
}
}
2 changes: 1 addition & 1 deletion addon/models/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default class FileModel extends Model {
@attr variant;
@attr name;
@attr metainfo;
@attr path;
@attr content;
@attr checksum;

@attr createdAt;
Expand Down
6 changes: 3 additions & 3 deletions addon/serializers/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ export default class TemplateSerializer extends JSONSerializer {
serializeIntoHash = null;

serialize(snapshot) {
const { name, variant, path } = snapshot.attributes();
const { name, variant, content} = snapshot.attributes();

const formData = new FormData();

formData.append("name", name);
formData.append("variant", variant);
formData.append("document", snapshot.belongsTo("document").id);

if (path instanceof File) {
formData.append("path", path);
if (content instanceof File) {
formData.append("content", content);
}

return formData;
Expand Down
2 changes: 1 addition & 1 deletion addon/services/documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default class DocumentsService extends Service {
document: documentModel,
createdByGroup: this.config.activeGroup,
modifiedByGroup: this.config.activeGroup,
path: file,
content: file,
});
await fileModel.save();

Expand Down

0 comments on commit d432404

Please sign in to comment.