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
class DatabaseServices { | |
constructor() { | |
this.studentRepository = null; | |
} | |
initDatabase() { | |
return new Promise((resolve, reject) => { | |
reject(new Error('not implemented')); | |
}); |
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
module.exports = class CrmServices { | |
notify(studentDetails) { | |
return new Promise((resolve, reject) => { | |
reject(new Error('not implemented')); | |
}); | |
} | |
}; |
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
module.exports = class StudentRepository { | |
constructor() { } | |
add(studentInstance) { | |
return new Promise((resolve, reject) => { | |
reject(new Error('not implemented')); | |
}); | |
} | |
update(studentInstance) { |
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
const AddStudent = require('../../application/use_cases/AddStudent'); | |
const GetAllStudents = require('../../application/use_cases/GetAllStudents'); | |
const GetStudent = require('../../application/use_cases/GetStudent'); | |
const AddEnrollment = require('../../application/use_cases/AddEnrollment'); | |
module.exports = (dependecies) => { | |
const { studentRepository } = dependecies.DatabaseService; | |
const { CrmServices } = dependecies; |
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
const StudentRepository = require('../../../application/contracts/StudentRepository'); | |
module.exports = class InMemoryStudentRepository extends StudentRepository { | |
constructor() { | |
super(); | |
this.students = []; | |
this.currentId = 1; | |
} |
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
const InMemoryDatabaseServices = require('../frameworks/persistance/InMemory/InMemoryDatabaseServices'); | |
const UniversityCrmServices = require('../frameworks/externalServices/UniversityCrmServices'); | |
module.exports = (() => { | |
return { | |
DatabaseService: new InMemoryDatabaseServices(), | |
CrmServices: new UniversityCrmServices() | |
}; | |
})(); |
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
module.exports = (() => { | |
return { | |
DatabaseService: new MongoDBDatabaseServices(), | |
CrmServices: new UniversityCrmServices() | |
}; | |
})(); |
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
module.exports = class Student { | |
constructor(id = null, firstName, lastName, email, Enrollments) { | |
this.id = id; | |
this.firstName = firstName; | |
this.lastName = lastName; | |
this.email = email; | |
this.Enrollments = Enrollments; | |
} | |
}; | |
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
{ | |
"query": { | |
"bool": { | |
"must": [ | |
{ | |
"match": { | |
"street": "ditmas" | |
} | |
}, | |
{ |
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
{ | |
"query": { | |
"bool": { | |
"filter": { | |
"range": { | |
"age": { | |
"gte": 20, | |
"lte": 30 | |
} | |
} |
OlderNewer