Skip to content

Commit c4612bb

Browse files
committed
Update to use new users_user table
1 parent c6138a5 commit c4612bb

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

core/models/user.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ type User struct {
2323

2424
const sqlSelectUser = `
2525
SELECT row_to_json(r) FROM (
26-
SELECT u.id, u.email, TRIM(CONCAT(u.first_name, ' ', u.last_name)) AS name, s.avatar
27-
FROM auth_user u
28-
INNER JOIN orgs_usersettings s ON s.user_id = u.id
29-
WHERE u.id = $1 AND u.is_active
26+
SELECT id, email, TRIM(CONCAT(u.first_name, ' ', last_name)) AS name, avatar
27+
FROM auth_user
28+
WHERE id = $1 AND is_active
3029
) r`
3130

3231
func LoadUser(ctx context.Context, rt *runtime.Runtime, id UserID) (*User, error) {

testsuite/schema.sql

+3-9
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,14 @@ CREATE TABLE contacts_contacturn (
5454
UNIQUE (org_id, identity)
5555
);
5656

57-
DROP TABLE IF EXISTS auth_user CASCADE;
58-
CREATE TABLE auth_user (
57+
DROP TABLE IF EXISTS users_user CASCADE;
58+
CREATE TABLE users_user (
5959
id serial primary key,
6060
email character varying(254) NOT NULL,
6161
first_name character varying(150),
6262
last_name character varying(150),
6363
is_active boolean NOT NULL,
64-
is_staff boolean NOT NULL
65-
);
66-
67-
DROP TABLE IF EXISTS orgs_usersettings CASCADE;
68-
CREATE TABLE orgs_usersettings (
69-
id serial primary key,
70-
user_id integer NOT NULL REFERENCES auth_user(id) ON DELETE CASCADE,
64+
is_staff boolean NOT NULL,
7165
avatar character varying(100) NULL
7266
);
7367

0 commit comments

Comments
 (0)