File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import type { AMASession } from '@chatsift/backend-core' ;
2+ import type { Selectable } from 'kysely' ;
3+
4+ export enum CurrentlyInQueue {
5+ mod ,
6+ guest ,
7+ answers ,
8+ }
9+
10+ interface GetNextQueueResult {
11+ kind : CurrentlyInQueue ;
12+ queueId : string ;
13+ }
14+
15+ export function getNextQueue ( currently : CurrentlyInQueue , session : Selectable < AMASession > ) : GetNextQueueResult | null {
16+ switch ( currently ) {
17+ case CurrentlyInQueue . answers : {
18+ return null ;
19+ }
20+
21+ case CurrentlyInQueue . guest : {
22+ return { kind : CurrentlyInQueue . answers , queueId : session . answersChannelId } ;
23+ }
24+
25+ case CurrentlyInQueue . mod : {
26+ if ( session . guestQueueId ) {
27+ return { kind : CurrentlyInQueue . guest , queueId : session . guestQueueId } ;
28+ }
29+
30+ return { kind : CurrentlyInQueue . answers , queueId : session . answersChannelId } ;
31+ }
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments