mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add api call to check is user has an elopage account to login-server and to apollo-server
This commit is contained in:
parent
49ad4d87ca
commit
cc8a4fcd5b
@ -242,4 +242,16 @@ export class UserResolver {
|
||||
}
|
||||
return new CheckEmailResponse(result.data)
|
||||
}
|
||||
}
|
||||
|
||||
@Query(() => Boolean)
|
||||
async hasElopage(@Ctx() context: any): Promise<Boolean> {
|
||||
const result = await apiGet(
|
||||
CONFIG.LOGIN_API_URL + 'hasElopage?session_id=' + context.sessionId,
|
||||
)
|
||||
if (!result.success) {
|
||||
throw new Error(result.data)
|
||||
}
|
||||
return result.data.hasElopage
|
||||
}
|
||||
|
||||
}
|
||||
16
login_server/src/cpp/JSONInterface/JsonHasElopage.cpp
Normal file
16
login_server/src/cpp/JSONInterface/JsonHasElopage.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "JsonHasElopage.h"
|
||||
#include "../model/table/ElopageBuy.h"
|
||||
|
||||
Poco::JSON::Object* JsonHasElopage::handle(Poco::Dynamic::Var params)
|
||||
{
|
||||
auto result = checkAndLoadSession(params);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
auto elopage_buy = Poco::AutoPtr<model::table::ElopageBuy>();
|
||||
|
||||
result = stateSuccess();
|
||||
result->set("hasElopage", elopage_buy->isExistInDB("email", mSession->getNewUser()->getModel()->getEmail()));
|
||||
|
||||
return result;
|
||||
}
|
||||
15
login_server/src/cpp/JSONInterface/JsonHasElopage.h
Normal file
15
login_server/src/cpp/JSONInterface/JsonHasElopage.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef __JSON_INTERFACE_JSON_HAS_ELOPAGE_
|
||||
#define __JSON_INTERFACE_JSON_HAS_ELOPAGE_
|
||||
|
||||
#include "JsonRequestHandler.h"
|
||||
|
||||
class JsonHasElopage : public JsonRequestHandler
|
||||
{
|
||||
public:
|
||||
Poco::JSON::Object* handle(Poco::Dynamic::Var params);
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif // __JSON_INTERFACE_JSON_HAS_ELOPAGE_
|
||||
@ -16,6 +16,7 @@
|
||||
#include "JsonUnknown.h"
|
||||
#include "JsonGetRunningUserTasks.h"
|
||||
#include "JsonGetUsers.h"
|
||||
#include "JsonHasElopage.h"
|
||||
#include "JsonLoginViaEmailVerificationCode.h"
|
||||
#include "JsonLogout.h"
|
||||
#include "JsonNetworkInfos.h"
|
||||
@ -140,6 +141,9 @@ Poco::Net::HTTPRequestHandler* JsonRequestHandlerFactory::createRequestHandler(c
|
||||
else if (url_first_part == "/logout") {
|
||||
return new JsonLogout(client_host);
|
||||
}
|
||||
else if (url_first_part == "/hasElopage") {
|
||||
return new JsonHasElopage;
|
||||
}
|
||||
|
||||
return new JsonUnknown;
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ namespace model {
|
||||
<< " WHERE " << fieldName << " = ?"
|
||||
, Poco::Data::Keywords::into(id), Poco::Data::Keywords::useRef(fieldValue);
|
||||
try {
|
||||
if (select.execute() == 1) {
|
||||
if (select.execute() >= 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user