-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All request handlers facade
- Loading branch information
Showing
27 changed files
with
227 additions
and
5 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,20 @@ | ||
import { object } from "firebase-functions/lib/providers/storage"; | ||
|
||
/** | ||
* @class | ||
* ORM (Object-Relational Mapping) Factory | ||
* Creates 'Entity' objects | ||
*/ | ||
export class EntityFactory { | ||
/** | ||
* @constructor | ||
* @param db | ||
*/ | ||
constructor(private db: FirebaseFirestore.Firestore){} | ||
/** | ||
* @function createRef | ||
*/ | ||
public createRef(collectionName: string){ | ||
return this.db.collection(collectionName); | ||
} | ||
} |
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,155 @@ | ||
import { WebhookClient, Card, Suggestion } from 'dialogflow-fulfillment'; | ||
import { EntityFactory } from './entity-factory'; | ||
/** | ||
* @class | ||
* Facade for all handlers | ||
*/ | ||
export class HandlerFacade { | ||
|
||
private entityFactory: EntityFactory; | ||
/** | ||
* @constructor | ||
* @param db firestore manager | ||
*/ | ||
constructor(db: FirebaseFirestore.Firestore){ | ||
this.entityFactory = new EntityFactory(db); | ||
} | ||
/** | ||
* @function welcome | ||
* @param agent | ||
*/ | ||
public welcome(agent: WebhookClient) { | ||
agent.add(`Hello! Lets chat 🔥`); | ||
} | ||
/** | ||
* @function fallback | ||
* @param agent | ||
*/ | ||
public fallback(agent: WebhookClient) { | ||
agent.add(`I didn't understand`); | ||
agent.add(`I'm sorry, can you try again?`); | ||
} | ||
/** | ||
* @function yourFunction | ||
* @param agent | ||
*/ | ||
public yourFunction(agent: WebhookClient) { | ||
agent.add(`This message is from Dialogflow's Cloud Functions for Firebase editor!`); | ||
agent.add(new Card({ | ||
title: `Title: this is a card title`, | ||
imageUrl: 'https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png', | ||
text: `This is the body text of a card. You can even use line\n breaks and emoji! 💁`, | ||
buttonText: 'This is a button', | ||
buttonUrl: 'https://assistant.google.com/' | ||
}) | ||
); | ||
agent.add(new Suggestion(`Quick Reply`)); | ||
agent.add(new Suggestion(`Suggestion`)); | ||
agent.setContext({ name: 'weather', lifespan: 2, parameters: { city: 'Rome' }}); | ||
} | ||
/** | ||
* @function getCourse | ||
* @param agent | ||
*/ | ||
public getCourse(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseInfo | ||
* @param agent | ||
*/ | ||
public getCourseInfo(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseRequirements | ||
* @param agent | ||
*/ | ||
public getCourseRequirements(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseWorkload | ||
* @param agent | ||
*/ | ||
public getCourseWorkload(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseTeacher | ||
* @param agent | ||
*/ | ||
public getCourseTeacher(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseSchedule | ||
* @param agent | ||
*/ | ||
public getCourseSchedule(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseCredit | ||
* @param agent | ||
*/ | ||
public getCourseCredit(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseFromScheduleDay | ||
* @param agent | ||
*/ | ||
public getCourseFromScheduleDay(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseFromScheduleDayHour | ||
* @param agent | ||
*/ | ||
public getCourseFromScheduleDayHour(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function fallbackGetCourseId2 | ||
* @param agent | ||
*/ | ||
public fallbackGetCourseId2(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseSuggestion | ||
* @param agent | ||
*/ | ||
public getCourseSuggestion(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseSuggestionBefore | ||
* @param agent | ||
*/ | ||
public getCourseSuggestionBefore(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseSuggestionAfter | ||
* @param agent | ||
*/ | ||
public getCourseSuggestionAfter(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseSuggestionBetween | ||
* @param agent | ||
*/ | ||
public getCourseSuggestionBetween(agent: WebhookClient) { | ||
|
||
} | ||
/** | ||
* @function getCourseSuggestionDays | ||
* @param agent | ||
*/ | ||
public getCourseSuggestionDays(agent: WebhookClient) { | ||
|
||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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 interface IAvaliacao { | ||
metodo: String, | ||
criterio: String, | ||
recuperacao: 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,4 @@ | ||
export interface ICredito { | ||
aula: number, | ||
trabalho: number | ||
} |
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,20 @@ | ||
import { ICredito as Credito } from './credito'; | ||
import { IDocente as Docente } from './docente'; | ||
import { IAvaliacao as Avaliacao } from './avaliacao'; | ||
import { IRequisito as Requisito } from './requisito'; | ||
import { IOferecimento as Oferecimento } from './oferecimento'; | ||
|
||
interface ICurso { | ||
sigla: String, | ||
name: String, | ||
creditos: Credito, | ||
carga_horaria: Number, | ||
objetivos: String, | ||
docentes: Docente[], | ||
programa: String, | ||
programa_resumido: String, | ||
avaliacao: Avaliacao, | ||
bibliografia: String[], | ||
requisitos: Requisito[], | ||
oferecimento: Oferecimento[] | ||
} |
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 interface IDocente { | ||
nome: 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,6 @@ | ||
export interface IHorario { | ||
dia: String, | ||
horario_inicio: String, | ||
horario_fim: String, | ||
professor: 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,7 @@ | ||
import { IHorario as Horario } from './horario'; | ||
|
||
export interface IOferecimento { | ||
codigo_turma: String, | ||
tipo_turma: String, | ||
horario: Horario[] | ||
} |
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 interface IRequisito { | ||
nome: String | ||
} |