refactor: event delegation, unified subscription cleanup, centralized listing status helpers

This commit is contained in:
2026-02-08 10:50:11 +01:00
parent 088db52258
commit 45e7f9dde7
14 changed files with 101 additions and 72 deletions

View File

@@ -75,6 +75,18 @@ class ListingsService {
&& listing.expires_at
&& new Date(listing.expires_at) > new Date()
}
canTogglePublish(listing) {
return listing.status === 'published' || (listing.status === 'draft' && this.isPaidAndActive(listing))
}
isSoftDeleted(listing) {
return listing.status === 'deleted'
}
canPublicView(listing) {
return listing.status === 'published'
}
}
export const listingsService = new ListingsService()