api/server.js
/*
	List today's menu by Mensa via identifier string for OpenMensa

	v2
*/
List today's menu by Mensa via identifier string for OpenMensa
v2
List today ' s menu by Mensa via identifier string for OpenMensa v2
function respondTodaysMenuByMensaV2(req, res, next) {
	var today = moment();
	console.log('respondTodaysMenuByMensaV2:', req.params[0]);
	queryDatabase("SELECT date, json_agg(json_build_object('mensa', mensa, 'menu', menus)) as canteen FROM (SELECT data->'date' as date, data->'mensa' as mensa, json_agg(json_build_object('category', data->>'menuName', 'name', data->>'name', 'price', json_build_object('student', data->>'minPrice', 'other', data->>'maxPrice')) ORDER BY data->>'menuName') as menus FROM menus WHERE data->>'date' >= $1 AND data->>'date' <= $2  AND data->'mensa'->>'uid' ~ ($3||'$') GROUP BY date, mensa ORDER BY date, mensa ) row GROUP BY date", 
		[today.format("YYYY-MM-DD"), today.format("YYYY-MM-DD"), req.params[0]],
		function(response) {
		res.send( response.rows );
		next();
	});
}
function respondTodaysMenuByMensaV2 ( req , res , next ) { var today = moment ( ) ; console . log ( 'respondTodaysMenuByMensaV2:' , req . params [ 0 ] ) ; queryDatabase ( "SELECT date, json_agg(json_build_object('mensa', mensa, 'menu', menus)) as canteen FROM (SELECT data->'date' as date, data->'mensa' as mensa, json_agg(json_build_object('category', data->>'menuName', 'name', data->>'name', 'price', json_build_object('student', data->>'minPrice', 'other', data->>'maxPrice')) ORDER BY data->>'menuName') as menus FROM menus WHERE data->>'date' >= $1 AND data->>'date' <= $2  AND data->'mensa'->>'uid' ~ ($3||'$') GROUP BY date, mensa ORDER BY date, mensa ) row GROUP BY date" , [ today . format ( "YYYY-MM-DD" ) , today . format ( "YYYY-MM-DD" ) , req . params [ 0 ] ] , function ( response ) { res . send ( response . rows ) ; next ( ) ; } ) ; }
List today's menu by Mensa via identifier string for OpenMensa
v2
List today ' s menu by Mensa via identifier string for OpenMensa v2