junobuild_cdn/proposals/workflows/
pre_commit_assets.rs1use crate::proposals::{Proposal, ProposalType};
2use crate::storage::heap::store::delete_assets;
3use crate::strategies::CdnHeapStrategy;
4use junobuild_collections::constants::assets::COLLECTION_ASSET_KEY;
5
6pub fn pre_commit_assets(cdn_heap: &impl CdnHeapStrategy, proposal: &Proposal) {
7 match &proposal.proposal_type {
8 ProposalType::AssetsUpgrade(ref options) => {
9 if let Some(true) = options.clear_existing_assets {
11 delete_assets(cdn_heap, &COLLECTION_ASSET_KEY.to_string());
12 }
13 }
14 ProposalType::SegmentsDeployment(_) => (),
15 }
16}