Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.

Commit b26c97c

Browse files
author
Yovangga Anandhika
committed
Reformat Select MariaDB
1 parent 6e96ffb commit b26c97c

File tree

15 files changed

+1472
-1172
lines changed

15 files changed

+1472
-1172
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
node_modules
22
.idea
33
dist
4+
test
45
yarn.lock
56
/test/info.losg
67
/test/error.log

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dkaframework/database",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"main": "dist/index.js",
55
"types": "dist/index.d.ts",
66
"author": {
@@ -12,7 +12,7 @@
1212
"private": false,
1313
"scripts": {
1414
"dev-test": "nodemon --watch src --watch test --exec ts-node test/index.ts",
15-
"build": "tsc --build"
15+
"build": "rimraf dist/* && tsc --build"
1616
},
1717
"config": {
1818
"forge": {
@@ -27,11 +27,15 @@
2727
"@types/jsbn": "^1.2.30",
2828
"@types/lodash": "^4.0.0",
2929
"@types/mysql": "^2.15.21",
30+
"firebase": "^9.13.0",
31+
"firebase-admin": "^11.2.0",
3032
"lodash": "^4.0.0",
3133
"mariadb": "^2.5.6",
3234
"moment": "^2.29.4",
3335
"moment-timezone": "^0.5.37",
36+
"mongodb": "^4.11.0",
3437
"mysqldump": "^3.2.0",
38+
"rimraf": "^3.0.2",
3539
"sqlite3": "^5.1.2",
3640
"tcp-port-used": "^1.0.2",
3741
"types": "^0.1.1",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import {FirebaseConfigConstructorConfiguration} from "./FirebaseConfigConstructor";
2+
import {FirebaseAppSettings, FirebaseOptions} from "@firebase/app";
3+
4+
5+
6+
export interface DKAFirebaseConfigConstructor {
7+
options : FirebaseOptions,
8+
config ?: string | undefined
9+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import {FirebaseAppSettings, FirebaseOptions} from "firebase/app";
2+
3+
/*export interface FirebaseConfigConstructorConfiguration extends FirebaseOptions {
4+
apiKey ?: string | undefined,
5+
authDomain ?: string | undefined,
6+
databaseURL ?: string | undefined,
7+
projectId ?: string | undefined,
8+
storageBucket ?: string | undefined,
9+
messagingSenderId ?: string | undefined,
10+
appId ?: string | undefined
11+
}*/
12+
export interface FirebaseConfigConstructorConfiguration extends FirebaseOptions, FirebaseAppSettings {
13+
apiKey ?: string | undefined,
14+
authDomain ?: string | undefined,
15+
databaseURL ?: string | undefined,
16+
projectId ?: string | undefined,
17+
storageBucket ?: string | undefined,
18+
messagingSenderId ?: string | undefined,
19+
appId ?: string | undefined
20+
}

src/Firestore/index.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*import firebase, {FirebaseApp, initializeApp, FirebaseOptions, } from "firebase/app";
2+
import { getFirestore, Firestore, collection, doc, getDocs, getDoc, CollectionReference, QueryDocumentSnapshot, DocumentReference, DocumentData }
3+
from "firebase/firestore"*/
4+
import firebase from 'firebase/compat/app';
5+
import 'firebase/compat/auth';
6+
import 'firebase/compat/firestore';
7+
import {DKAFirebaseConfigConstructor} from "./Config/DKAFirebaseConfigConstructor";
8+
9+
export class FireStore {
10+
11+
private get Firestore(): firebase.firestore.Firestore | undefined {
12+
return this._Firestore;
13+
}
14+
15+
private set Firestore(value: firebase.firestore.Firestore | undefined) {
16+
this._Firestore = value;
17+
}
18+
19+
private get app(): firebase.app.App | undefined {
20+
return this._app;
21+
}
22+
23+
private set app(value: firebase.app.App | undefined) {
24+
this._app = value;
25+
}
26+
27+
private _app : firebase.app.App | undefined
28+
private _Firestore : firebase.firestore.Firestore | undefined;
29+
30+
constructor(config : DKAFirebaseConfigConstructor) {
31+
32+
let mConfig : DKAFirebaseConfigConstructor | undefined = config;
33+
34+
switch (typeof mConfig?.config) {
35+
case "string":
36+
this.app = firebase.initializeApp(mConfig.options, mConfig?.config)
37+
this.Firestore = firebase.firestore(this.app)
38+
break;
39+
default :
40+
this.app = firebase.initializeApp({});
41+
this.Firestore = firebase.firestore(this.app)
42+
break;
43+
}
44+
}
45+
46+
collection(collectionPath : string) : firebase.firestore.CollectionReference<firebase.firestore.DocumentData> {
47+
return this.Firestore?.collection(collectionPath)!;
48+
}
49+
50+
}
51+
52+
export default FireStore;

src/MariaDB/Interfaces/Class.ts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ export interface RulesSelectOrderBy {
2020
}
2121

2222
export interface RulesSelectSearch {
23-
coloumName? : string | undefined,
24-
valueName? : string | undefined
23+
coloumName ?: string | undefined,
24+
condition : "LIKE" | "=" | "!="
25+
data ?: string | bigint | number | undefined
2526
}
2627

2728
export interface RulesSelectSettings {
@@ -31,9 +32,30 @@ export interface RulesSelectSettings {
3132
rows ?: boolean | undefined
3233
}
3334

35+
export interface RulesSelectJoinOnAlias {
36+
tableAlias : string | undefined,
37+
collName : string | undefined
38+
}
39+
export interface RulesSelectJoinOn {
40+
collNameFirst : RulesSelectJoinOnAlias,
41+
collNameSecond : RulesSelectJoinOnAlias
42+
}
43+
export interface RulesSelectJoin {
44+
mode ?: | undefined | "INNER" | "ALTER" | "OUTER",
45+
column ?: Array<String> | undefined,
46+
TableName ?: string | undefined,
47+
as ?: string | undefined
48+
on ?: RulesSelectJoinOn | undefined
49+
}
50+
51+
export interface RulesSelectColumn {
52+
alias ?: string,
53+
name ?: string
54+
}
3455
export interface RulesSelect extends Rules {
35-
search? : Array<Object | String> | RulesSelectSearch | undefined,
36-
column? : Array<String> | undefined,
56+
join ?: Array<RulesSelectJoin> | RulesSelectJoin | undefined,
57+
search? : Array<RulesSelectSearch> | RulesSelectSearch | undefined,
58+
column? : Array<RulesSelectColumn> | Array<string> | undefined,
3759
limit? : number | undefined,
3860
orderBy? : RulesSelectOrderBy | undefined
3961
settings ?: RulesSelectSettings | undefined

0 commit comments

Comments
 (0)