I'm currently working on a hosting project so this is how I design an entity for storing hosting information.
// entity design for storing hosting instance
data class HostingInstance(
val hostingId: String,
val customerId: String,
val active: Boolean,
val status: HostingStatus,
...
)
// enum class for status
enum class HostingStatus {
CREATION_PENDING,
CREATION_SUCCESS,
CREATION_FAILED,
RENEW_PENDING,
RENEW_SUCCESS,
RENEW_FAILED,
SUSPEND_PENDING,
SUSPEND_SUCCESS,
SUSPEND_FAILED,
UPGRADE_PENDING,
UPGRADE_SUCCESS,
UPGRADE_FAILED,
...
}
As you can see there are a lot of status that I have to store. On the front-end side they also have a fixed status icon such as active, suspend, fail (upgrade_failed and renew_failed are also active) and I feel bad for them because they have to map all my enum status to their icon which is a really big and hard work. So my question is how should I design my status field so the frontend team can easily use?
Aucun commentaire:
Enregistrer un commentaire