File tree Expand file tree Collapse file tree
hasura/metadata/databases/default/tables Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -182,3 +182,19 @@ delete_permissions:
182182 - steam_id :
183183 _eq : X-Hasura-User-Id
184184 comment : " "
185+ event_triggers :
186+ - name : match_lineup_players
187+ definition :
188+ delete :
189+ columns : ' *'
190+ enable_manual : false
191+ insert :
192+ columns : ' *'
193+ update :
194+ columns :
195+ - captain
196+ retry_conf :
197+ interval_sec : 10
198+ num_retries : 0
199+ timeout_sec : 60
200+ webhook : ' {{HASURA_GRAPHQL_EVENT_HOOK}}'
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414 matches_set_input ,
1515 servers_set_input ,
1616 game_server_nodes_set_input ,
17+ match_lineup_players_set_input ,
1718} from "../../generated" ;
1819import { ConfigService } from "@nestjs/config" ;
1920import { AppConfig } from "src/configs/types/AppConfig" ;
@@ -1205,4 +1206,43 @@ export class MatchesController {
12051206 success : true ,
12061207 } ;
12071208 }
1209+
1210+ @HasuraEvent ( )
1211+ public async match_lineup_players (
1212+ data : HasuraEventData < match_lineup_players_set_input > ,
1213+ ) {
1214+ const match_lineup_id = ( data . new . match_lineup_id ||
1215+ data . old . match_lineup_id ) as string ;
1216+ const { matches } = await this . hasura . query ( {
1217+ matches : {
1218+ where : {
1219+ _or : [
1220+ {
1221+ lineup_1_id : {
1222+ _eq : match_lineup_id ,
1223+ } ,
1224+ } ,
1225+ {
1226+ lineup_2_id : {
1227+ _eq : match_lineup_id ,
1228+ } ,
1229+ } ,
1230+ ] ,
1231+ } ,
1232+ id : true ,
1233+ status : true ,
1234+ } ,
1235+ } ) ;
1236+ const match = matches . at ( 0 ) ;
1237+
1238+ if ( ! match ) {
1239+ return ;
1240+ }
1241+
1242+ if ( ! [ "Live" ] . includes ( match . status ) ) {
1243+ return ;
1244+ }
1245+
1246+ await this . matchAssistant . sendServerMatchId ( match . id ) ;
1247+ }
12081248}
You can’t perform that action at this time.
0 commit comments