File size: 333 Bytes
30a3fac
 
 
 
 
 
1
2
3
4
5
6
7
// Shared ticket status mapping. DB stores status as an int; APIs use labels.
// Index in STATUSES = the stored integer value.
export const STATUSES = ['open', 'queued', 'processing', 'done', 'failed', 'close'];

export const statusToInt = (label) => STATUSES.indexOf(label);
export const intToStatus = (n) => STATUSES[n] ?? 'open';