api endpoint returns actives parents by default

This commit is contained in:
marko
2023-12-24 15:34:07 +01:00
parent 646dad6786
commit 9ab62485a6
3 changed files with 17 additions and 4 deletions

View File

@@ -27,9 +27,22 @@ if (!$allowKey || !$allowKey->isValidFor('api')) {
die(json_encode(['success' => false]));
}
$wkSqlQuery = 'SELECT * FROM `wettkampfkalender` WHERE `Datum` >= CURDATE();';
$wkSqlQuery = "SELECT DISTINCT"
." `wkParticipo_Users`.* "
." FROM `wkParticipo_Users`"
." JOIN `vormundschaft`"
." ON `wkParticipo_Users`.`id` =`vormundschaft`.`userId`"
." JOIN `wkParticipo_user<=>userAttributes`"
." ON `wkParticipo_user<=>userAttributes`.`userId` = `vormundschaft`.`kidId`"
." WHERE `wkParticipo_user<=>userAttributes`.`attributeId` = 4"
." ORDER BY `wkParticipo_Users`.`id` ASC;";
$wkSqlResponse = dbConnector::query($wkSqlQuery);
foreach( $wkSqlResponse as &$user){
$user['eMail'] = explode(",", $user['eMail']);
}
header('Access-Control-Allow-Headers: *');
header('Access-Control-Allow-Origin: *');

5
homepage/participo/testApi.py Normal file → Executable file
View File

@@ -1,3 +1,5 @@
#! /usr/bin/env python
from http import client
import logging
import json
@@ -27,7 +29,6 @@ try:
print(json.dumps(json.loads(body),indent=2))
except:
print(f"failed to parse to json")
print(body
)
print(body)
connection.close()

View File

@@ -13,7 +13,6 @@ $db = dbConnector::connect(
$cwsvJudoConfig['db']['user'],
$cwsvJudoConfig['db']['password']
);
// echo($db);
$wkSqlQuery = 'SELECT * FROM `wettkampfkalender` WHERE `Datum` >= CURDATE();';
$wkSqlResponse = dbConnector::query($wkSqlQuery);