u
This commit is contained in:
@@ -15,6 +15,8 @@ import langCreate from './store/lang/create.js';
|
||||
import langDelete from './store/lang/delete.js';
|
||||
import langList from './store/lang/list.js';
|
||||
import googleAuthAdd from './store/google_auth/add.js';
|
||||
import googleAuthGetById from './store/google_auth/getById.js';
|
||||
import googleAuthGetByEmail from './store/google_auth/getByEmail.js';
|
||||
import googleAuthList from './store/google_auth/list.js';
|
||||
import googleAuthDel from './store/google_auth/del.js';
|
||||
import storePurge from './store/purge.js';
|
||||
@@ -54,6 +56,8 @@ export default class LibDashStore {
|
||||
|
||||
this.google_auth = {
|
||||
add: googleAuthAdd(pool),
|
||||
getById: googleAuthGetById(pool),
|
||||
getByEmail: googleAuthGetByEmail(pool),
|
||||
list: googleAuthList(pool),
|
||||
del: googleAuthDel(pool),
|
||||
};
|
||||
|
||||
@@ -4,6 +4,18 @@ OUTPUT INSERTED.id
|
||||
VALUES (@email)
|
||||
`;
|
||||
|
||||
export const GET_BY_ID = `
|
||||
SELECT id, email, created_at, selected_company
|
||||
FROM google_auth
|
||||
WHERE id = @id
|
||||
`;
|
||||
|
||||
export const GET_BY_EMAIL = `
|
||||
SELECT id, email, created_at, selected_company
|
||||
FROM google_auth
|
||||
WHERE email = @email
|
||||
`;
|
||||
|
||||
export const LIST = `
|
||||
SELECT id, email, created_at, selected_company
|
||||
FROM google_auth
|
||||
|
||||
13
src/store/google_auth/getByEmail.js
Normal file
13
src/store/google_auth/getByEmail.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import sql from 'mssql';
|
||||
import { GET_BY_EMAIL } from '../../sql/google_auth.js';
|
||||
|
||||
export default function getByEmail(pool) {
|
||||
return async (email) => {
|
||||
const result = await pool
|
||||
.request()
|
||||
.input('email', sql.NVarChar(320), email)
|
||||
.query(GET_BY_EMAIL);
|
||||
|
||||
return result.recordset[0];
|
||||
};
|
||||
}
|
||||
13
src/store/google_auth/getById.js
Normal file
13
src/store/google_auth/getById.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import sql from 'mssql';
|
||||
import { GET_BY_ID } from '../../sql/google_auth.js';
|
||||
|
||||
export default function getById(pool) {
|
||||
return async (id) => {
|
||||
const result = await pool
|
||||
.request()
|
||||
.input('id', sql.Int, id)
|
||||
.query(GET_BY_ID);
|
||||
|
||||
return result.recordset[0];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user