fix: rename “users.token” => "users.github_token”

pull/2572/head
Luke Edwards 7 years ago
parent 35485f995b
commit e3331aca58

@ -6,7 +6,7 @@ exports.up = DB => {
name character varying(255),
username character varying(255) not null,
avatar text,
token character varying(255) not null,
github_token character varying(255) not null,
created_at timestamp with time zone NOT NULL DEFAULT now(),
updated_at timestamp with time zone
);

@ -79,7 +79,8 @@ export function API() {
send(res, 302, Location, { Location });
} catch (err) {
//
console.error('GET /auth/login', err);
send(res, 500);
}
});
@ -105,9 +106,9 @@ export function API() {
// Upsert `users` table
const [user] = await query(`
insert into users(uid, name, username, avatar, token)
insert into users(uid, name, username, avatar, github_token)
values ($1, $2, $3, $4, $5) on conflict (uid) do update
set (name, username, avatar, token, updated_at) = ($2, $3, $4, $5, now())
set (name, username, avatar, github_token, updated_at) = ($2, $3, $4, $5, now())
returning *
`, [id, name, login, avatar_url, access_token]);
@ -121,7 +122,7 @@ export function API() {
'Content-Type': 'text/html; charset=utf-8'
});
} catch (err) {
console.error('OAuth Callback', err);
console.error('GET /auth/callback', err);
send(res, 500, err.data, {
'Content-Type': err.headers['content-type'],
'Content-Length': err.headers['content-length']

Loading…
Cancel
Save