GPCM: Do updatepro/getprofile in the right order

This commit is contained in:
TheLordScruffy
2023-09-14 17:31:20 -04:00
parent eb45c1b5cc
commit a3108d819d
4 changed files with 28 additions and 13 deletions

View File

@@ -2,8 +2,9 @@ package database
import (
"context"
"github.com/jackc/pgx/v4/pgxpool"
"wwfc/common"
"github.com/jackc/pgx/v4/pgxpool"
)
const (
@@ -88,8 +89,10 @@ func LoginUserToGCPM(pool *pgxpool.Pool, ctx context.Context, authToken string)
// Create the GPCM account
user.CreateUser(pool, ctx)
} else {
// TODO get the profile ID!!!!!
user.ProfileId = 474888031
err := pool.QueryRow(ctx, GetUserProfileID, userId).Scan(&user.ProfileId)
if err != nil {
panic(err)
}
}
return user

View File

@@ -3,9 +3,10 @@ package database
import (
"context"
"errors"
"wwfc/common"
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v4/pgxpool"
"wwfc/common"
)
const (
@@ -15,6 +16,7 @@ const (
CreateUserSession = `INSERT INTO sessions (session_key, profile_id, login_ticket) VALUES ($1, $2, $3)`
DoesUserExist = `SELECT EXISTS(SELECT 1 FROM users WHERE user_id = $1 AND gsbrcd = $2)`
DeleteUserSession = `DELETE FROM sessions WHERE profile_id = $1`
GetUserProfileID = `SELECT profile_id FROM users WHERE user_id = $1`
)
type User struct {