
AdminJS는 백오피스를 편하게 구성해준다. ORM의 엔티티만 추가해도 CRUD가 가능하다.
파일 업로드를 위해 uploadFileFeature 함수를 지원한다. 하지만 mimeType 프로퍼티를 설정해도 S3에 업로드된 파일의 Content-Type은 application/octet-stream으로 설정되어 브라우저에서 열리지 않는다. 다운로드만 될 뿐.
actions: {
new: {
after: async (response: ActionResponse) => {
await updateImageData(response);
return response;
},
},
edit: {
after: async (response: ActionResponse) => {
await updateImageData(response);
return response;
},
},
},
s3.copyObject({
Bucket: bucket,
Key: fileName,
CopySource: `${bucket}/${fileName}`,
ContentType: '여기서 설정',
MetadataDirective: 'REPLACE',
})
.then((data) => console.log(data))
.catch((err) => console.log(err));
마음에 드는 해결책은 아니지만 원활한 운영을 위해 커밋했다. 깃헙에 이슈를 제보하려는데 이미 올라와 있더라. 4년전에.
https://github.com/SoftwareBrothers/adminjs-upload/issues/37
관리가 더 잘되는 프로젝트였으면...