upsert user
All checks were successful
App Image CI / Build app image (push) Successful in -1m28s
NPM Audit Check / Check NPM audit (push) Successful in -2m13s

This commit is contained in:
2025-09-26 14:38:17 -05:00
parent 45ebb7d9cf
commit f39ce0977f
4 changed files with 13 additions and 7 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "archery", "name": "archery",
"version": "0.2.0", "version": "0.2.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "archery", "name": "archery",
"version": "0.2.0", "version": "0.2.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"body-parser": "^2.2.0", "body-parser": "^2.2.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "archery", "name": "archery",
"version": "0.2.0", "version": "0.2.1",
"description": "Build Arch packages through a web interface", "description": "Build Arch packages through a web interface",
"keywords": [ "keywords": [
"docker", "docker",

View File

@@ -216,6 +216,15 @@ class DB extends Store {
return user.id; return user.id;
} }
public async upsertUser(user: User): Promise<string> {
await this.user.upsert({
id: user.id,
username: user.username,
displayName: user.displayName || null
});
return user.id;
}
public async createBuild(repo: string, commit: string, patch: string, distro: string, dependencies: string, author: string, uuid: string): Promise<number> { public async createBuild(repo: string, commit: string, patch: string, distro: string, dependencies: string, author: string, uuid: string): Promise<number> {
const buildRec = await this.build.create({ const buildRec = await this.build.create({
repo, repo,

View File

@@ -331,10 +331,7 @@ class Web {
username: profile.username, username: profile.username,
displayName: profile.displayName displayName: profile.displayName
}; };
const user = await this.db.getUser(profile.id); await this.db.upsertUser(userObj);
if (!user) {
await this.db.createUser(userObj);
}
return cb(null, userObj); return cb(null, userObj);
}); });
} }