-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Project structure to enable shared code
- The "shared" project is now in the "functions" project, because all the code that functions use, should be in that directory. - Yarn workspaces are introduced, to be able to access the code in "functions" from the "web" project.
- Loading branch information
BenjaVR
committed
Dec 18, 2018
1 parent
2cea74c
commit 1b74347
Showing
48 changed files
with
12,683 additions
and
21,109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/// <reference types="express" /> | ||
import * as functions from "firebase-functions"; | ||
export declare const test: functions.TriggerAnnotated & ((req: functions.Request, resp: functions.Response) => void) & functions.Runnable<any>; | ||
export declare const addSchool: functions.TriggerAnnotated & ((req: functions.Request, resp: functions.Response) => void) & functions.Runnable<any>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Language } from "../translations/types"; | ||
export interface IFirebaseFunctionParam<T> { | ||
lang: Language; | ||
data: T; | ||
} | ||
export interface IFirebaseFunctionResponse<T> { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ValidationResult } from "../validators/ValidationResult"; | ||
export interface ILoginDetails { | ||
username: string; | ||
password: string; | ||
} | ||
export declare function validateLoginDetails(loginDetails: ILoginDetails): ValidationResult<ILoginDetails>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ValidationResult } from "../validators/ValidationResult"; | ||
export interface ISchool { | ||
id?: string; | ||
name: string; | ||
} | ||
export declare function validateSchool(school: ISchool): ValidationResult<ISchool>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { ILanguage, I18nextResourceTranslations } from "./types"; | ||
export declare class En implements ILanguage { | ||
getTranslations(): I18nextResourceTranslations; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { I18nextResourceTranslations, ILanguage } from "./types"; | ||
export declare class Nl implements ILanguage { | ||
getTranslations(): I18nextResourceTranslations; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export interface I18nextResource { | ||
[key: string]: any; | ||
} | ||
export declare type I18nextResourceTranslations = I18nextResource & ITranslations; | ||
export interface ILanguage { | ||
getTranslations(): ITranslations; | ||
} | ||
export declare type Language = "nl" | "en"; | ||
export interface ITranslations { | ||
"validation.field_should_not_be_empty": string; | ||
"validation.model_should_not_have_id": string; | ||
"auth.logged_in_successfully": string; | ||
"auth.logging_in_failed": string; | ||
"auth.logged_out_successfully": string; | ||
"auth.welcome_back{{username}}": string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export declare class FirebaseValidator { | ||
static hasId(value: { | ||
id?: string; | ||
}): boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export declare class StringValidator { | ||
static isEmpty(value: string): boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ITranslations } from "../translations/types"; | ||
export declare class ValidationError<T> { | ||
readonly field: keyof T; | ||
/** | ||
* Translation key that contains the error message. | ||
*/ | ||
readonly translationKey: keyof ITranslations; | ||
constructor(field: keyof T, translationKey: keyof ITranslations); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ValidationError } from "./ValidationError"; | ||
export declare class ValidationResult<T> { | ||
readonly instance: T; | ||
readonly errors: Array<ValidationError<T>>; | ||
constructor(instance: T); | ||
add(error: ValidationError<T>): void; | ||
hasErrors(): boolean; | ||
getErrorsWithField(field: keyof T): Array<ValidationError<T>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist/ |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
shared/src/models/LoginDetails.ts → functions/src/shared/models/LoginDetails.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
shared/src/models/School.ts → functions/src/shared/models/School.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
shared/src/translations/types.ts → functions/src/shared/translations/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
interface I18nextResource { | ||
export interface I18nextResource { | ||
[key: string]: any; | ||
} | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
shared/src/validators/FirebaseValidator.ts → ...rc/shared/validators/FirebaseValidator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
shared/src/validators/StringValidator.ts → .../src/shared/validators/StringValidator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.