Finally have prettier and linting maybe working
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-05-02 10:54:45 -04:00
parent 34acea15a2
commit 7f5765aaaa
19 changed files with 528 additions and 322 deletions

View File

@@ -1,17 +1,14 @@
import Auth from '../model/auth';
import auth from '../model/auth';
import { AuthModel, AuthPrivate } from '../schema/auth';
import { sign } from './jwt';
export const getAuthenticationBundle = async (
username: string,
password: string,
) => {
const auth = await Auth.findByUsername(username).catch();
const isAuthenticated = !!auth && (auth as AuthModel).authenticate(password);
const record = isAuthenticated ? (auth as AuthPrivate).record : null;
const token = isAuthenticated ? (auth as AuthModel).getToken() : sign();
return {
record,
token,
};
export const getAuthenticationBundle = async (username: string, password: string) => {
const auth = await Auth.findByUsername(username).catch();
const isAuthenticated = !!auth && (auth as AuthModel).authenticate(password);
const record = isAuthenticated ? (auth as AuthPrivate).record : null;
const token = isAuthenticated ? (auth as AuthModel).getToken() : sign();
return {
record,
token,
};
};