59 lines
1.0 KiB
JavaScript
59 lines
1.0 KiB
JavaScript
export const ADD = `
|
|
INSERT INTO google_auth (email)
|
|
OUTPUT INSERTED.id
|
|
VALUES (@email)
|
|
`;
|
|
|
|
export const GOOGLE_AUTH_COLUMNS = `
|
|
id,
|
|
email,
|
|
picture,
|
|
picturebinary AS pictureBinary,
|
|
sub,
|
|
created_at AS createdAt,
|
|
selected_company AS selectedCompanyId
|
|
`;
|
|
|
|
export const GET_BY_EMAIL = `
|
|
SELECT
|
|
${GOOGLE_AUTH_COLUMNS}
|
|
FROM google_auth
|
|
WHERE email = @email
|
|
`;
|
|
|
|
export const GET_BY_ID = `
|
|
SELECT
|
|
${GOOGLE_AUTH_COLUMNS}
|
|
FROM google_auth
|
|
WHERE id = @googleAuthId
|
|
`;
|
|
|
|
export const LIST_ALLOWED_EMAILS = `
|
|
SELECT
|
|
id,
|
|
email,
|
|
picture,
|
|
sub,
|
|
created_at AS createdAt,
|
|
selected_company AS selectedCompanyId
|
|
FROM google_auth
|
|
ORDER BY email
|
|
`;
|
|
|
|
export const REMOVE_ALLOWED_EMAIL = `
|
|
DELETE FROM google_auth
|
|
WHERE email = @email
|
|
`;
|
|
|
|
export const SET_SELECTED_COMPANY = `
|
|
UPDATE google_auth
|
|
SET selected_company = @companyId
|
|
WHERE id = @googleAuthId
|
|
`;
|
|
|
|
export const SET_PROFILE = `
|
|
UPDATE google_auth
|
|
SET picture = @picture, picturebinary = @pictureBinary, sub = @sub
|
|
WHERE id = @googleAuthId
|
|
`;
|