chore: Add authentication interface and adjust authentication classes

This commit is contained in:
Faruk AYDIN
2022-03-01 15:14:56 +03:00
committed by Ali BARIN
parent a506d1985f
commit b2369fa8cd
14 changed files with 144 additions and 93 deletions

View File

@@ -1,18 +1,21 @@
import AuthenticationInterface from '../../types/interfaces/authentication-interface';
import { Client } from 'pg';
import AppInfo from '../../types/app-info';
import JSONObject from '../../types/interfaces/json-object';
export default class Authentication {
appData: any;
connectionData: any;
client: any;
export default class Authentication implements AuthenticationInterface {
appData: AppInfo;
connectionData: JSONObject;
client: Client;
constructor(appData: any, connectionData: any) {
constructor(appData: AppInfo, connectionData: JSONObject) {
this.client = new Client({
host: connectionData.host,
port: connectionData.port,
database: connectionData.database,
user: connectionData.username,
password: connectionData.password,
ssl: connectionData.ssl,
host: connectionData.host as string,
port: connectionData.port as number,
database: connectionData.database as string,
user: connectionData.username as string,
password: connectionData.password as string,
ssl: connectionData.ssl as boolean,
});
this.connectionData = connectionData;