getGameInfoU
This commit is contained in:
@@ -38,15 +38,26 @@ const pool = mariadb.createPool({
|
||||
const query1 = `SELECT * FROM game_cross_varient1 WHERE ${queryCondition}`;
|
||||
const query2 = `SELECT * FROM game_cross_varient2 WHERE ${queryCondition}`;
|
||||
|
||||
const [game1Results, game2Results] = await Promise.all([
|
||||
const [game_cross_varient1, game_cross_varient2] = await Promise.all([
|
||||
connection.query(query1, [queryValue]),
|
||||
connection.query(query2, [queryValue]),
|
||||
]);
|
||||
|
||||
const domain = 'https://domain.com/gamelink/?id=';
|
||||
const formattedGame1 = game_cross_varient1.map(game => ({
|
||||
...game,
|
||||
game_link: `${domain}sdfs${game.id}`,
|
||||
}));
|
||||
|
||||
const formattedGame2 = game_cross_varient2.map(({ status, ...game }) => ({
|
||||
...game,
|
||||
game_link: `${domain}${game.id}`,
|
||||
}));
|
||||
|
||||
// Combine results from both tables
|
||||
const combinedResults = {
|
||||
game_cross_varient1: game1Results,
|
||||
game_cross_varient2: game2Results,
|
||||
game_cross_varient1: formattedGame1,
|
||||
game_cross_varient2: formattedGame2,
|
||||
};
|
||||
|
||||
res.status(200).send(combinedResults);
|
||||
|
||||
Reference in New Issue
Block a user