chore: 🤖 Update serializer for storage buckets (#282)
This commit is contained in:
1 parent
67a23a50fe
commit
c63c95fd51
3 files changed
+63
-7
No files matched your search
@@ -1,13 +1,22 @@
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default class StorageBucketSerializer extends ApplicationSerializer {
|
||||
serialize(snapshot) {
|
||||
const serialized = super.serialize(...arguments);
|
||||
if (!snapshot.record.isNew) {
|
||||
delete serialized.bucket_name;
|
||||
delete serialized.bucket_prefix;
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
|
||||
normalize(typeClass, hash, ...rest) {
|
||||
const normalizedHash = structuredClone(hash);
|
||||
const normalized = super.normalize(typeClass, normalizedHash, ...rest);
|
||||
|
||||
// Remove secret fields
|
||||
delete normalized.data.attributes.access_key_id;
|
||||
delete normalized.data.attributes.secret_access_key;
|
||||
// Remove secret fields so we don't track them after creating/updating
|
||||
normalized.data.attributes.access_key_id = null;
|
||||
normalized.data.attributes.secret_access_key = null;
|
||||
return normalized;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user