mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 05:14:23 +00:00
working occupied seats
This commit is contained in:
@@ -30,7 +30,6 @@ class GETHandler {
|
||||
if ( query.event ) {
|
||||
db.getJSONDataSimple( 'booked', query.event ).then( data => {
|
||||
db.getDataSimple( 'temp', 'user_id', session.id ).then( dat => {
|
||||
console.log( dat );
|
||||
resolve( { 'booked': data ?? {}, 'user': dat[ 0 ] ? JSON.parse( dat[ 0 ].data )[ query.event ] ?? {} : {} } );
|
||||
} );
|
||||
} ).catch( error => {
|
||||
|
||||
@@ -11,7 +11,7 @@ const db = require( '../db/db.js' );
|
||||
|
||||
class POSTHandler {
|
||||
constructor () {
|
||||
this.allSelectedSeats = { 'TestEvent2': [ 'secAr1s1' ] };
|
||||
this.allSelectedSeats = { 'TestEvent2': [ { 'id': 'secAr1s1', 'component': 1 } ] };
|
||||
}
|
||||
|
||||
// Add lang in the future
|
||||
@@ -31,7 +31,7 @@ class POSTHandler {
|
||||
if ( this.allSelectedSeats[ data.eventID ].includes( data.id ) ) {
|
||||
reject( { 'code': 409, 'message': 'Seat already selected' } );
|
||||
} else {
|
||||
this.allSelectedSeats[ data.eventID ].push( data.id );
|
||||
this.allSelectedSeats[ data.eventID ].push( { 'id': data.id, 'component': data.component } );
|
||||
transmit[ data.eventID ][ data.id ] = data;
|
||||
db.writeDataSimple( 'temp', 'user_id', session.id, { 'user_id': session.id, 'data': JSON.stringify( transmit ), 'timestamp': new Date().toString() } ).then( () => {
|
||||
resolve( 'ok' );
|
||||
@@ -69,8 +69,8 @@ class POSTHandler {
|
||||
} );
|
||||
}
|
||||
|
||||
getReservedSeats () {
|
||||
return this.allSelectedSeats;
|
||||
getReservedSeats ( event ) {
|
||||
return this.allSelectedSeats[ event ];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user