mirror of
https://github.com/quepasaevents/qpa-client.git
synced 2023-12-14 05:33:02 +01:00
Works
This commit is contained in:
parent
07f2537382
commit
c10998d519
|
@ -16,6 +16,7 @@ exports.isUserAvailable = (req, res) => __awaiter(this, void 0, void 0, function
|
|||
email: params.email,
|
||||
username: params.username
|
||||
});
|
||||
console.log('got user from repository', JSON.stringify(user));
|
||||
res.send({
|
||||
exists: !!user
|
||||
});
|
||||
|
|
|
@ -32,6 +32,7 @@ class Repository {
|
|||
}
|
||||
static getUser(user) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
console.log('Search for user', JSON.stringify(user));
|
||||
let query = datastore
|
||||
.createQuery('user');
|
||||
if (user.email) {
|
||||
|
@ -42,7 +43,12 @@ class Repository {
|
|||
}
|
||||
return yield datastore.runQuery(query)
|
||||
.then(results => {
|
||||
return results[0];
|
||||
console.log('Got results', JSON.stringify(results));
|
||||
const resultSet = results[0];
|
||||
if (resultSet.length > 1) {
|
||||
console.warn('Got more than one user, should have gotten at most one', JSON.stringify(resultSet));
|
||||
}
|
||||
return resultSet.length ? resultSet[0] : null;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
"typescript": "^2.8.1"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "./node_modules/.bin/tsc"
|
||||
"build": "./node_modules/.bin/tsc",
|
||||
"deploy": "gcloud beta functions deploy isUserAvailable --trigger-http",
|
||||
"logs": "gcloud beta functions logs read"
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ export const isUserAvailable = async (req, res) => {
|
|||
username: params.username as string
|
||||
})
|
||||
|
||||
console.log('got user from repository', JSON.stringify(user))
|
||||
res.send({
|
||||
exists: !!user
|
||||
});
|
||||
|
|
|
@ -25,6 +25,7 @@ export default class Repository {
|
|||
}
|
||||
|
||||
static async getUser (user: UserKeys) {
|
||||
console.log('Search for user', JSON.stringify(user))
|
||||
let query = datastore
|
||||
.createQuery('user')
|
||||
|
||||
|
@ -37,7 +38,12 @@ export default class Repository {
|
|||
|
||||
return await datastore.runQuery(query)
|
||||
.then(results => {
|
||||
return results[0]
|
||||
console.log('Got results', JSON.stringify(results))
|
||||
const resultSet = results[0]
|
||||
if (resultSet.length > 1) {
|
||||
console.warn('Got more than one user, should have gotten at most one', JSON.stringify(resultSet))
|
||||
}
|
||||
return resultSet.length ? resultSet[0] : null
|
||||
});
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue