Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • main
1 result

Target

Select target project
  • h21213497/gorillapi
1 result
Select Git revision
  • main
1 result
Show changes
Commits on Source (2)
node_modules
--------------------------------------------------------------------------------
-- Up
--------------------------------------------------------------------------------
CREATE TABLE species (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
habitat VARCHAR(50),
height FLOAT,
weight FLOAT,
diet VARCHAR(50)
);
CREATE TABLE monkey (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
species_id INT,
sex VARCHAR(10),
age INT,
birth_loc VARCHAR(50),
live_loc VARCHAR(50),
FOREIGN KEY (species_id) REFERENCES species(id)
);
--------------------------------------------------------------------------------
-- Down
--------------------------------------------------------------------------------
DROP TABLE monkey;
DROP TABLE species;
\ No newline at end of file
This diff is collapsed.
{
"name": "monkapi",
"version": "1.0.0",
"description": "The monkiest API of all time",
"main": "index.js",
"type": "module",
"scripts": {
"start": "nodemon index",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "V. Henriques",
"license": "ISC",
"dependencies": {
"express": "^4.18.2",
"sqlite": "^5.1.1",
"sqlite3": "^5.1.6"
},
"devDependencies": {
"nodemon": "^2.0.22",
"standard": "^17.0.0"
}
}
class MonkeyDbDAO{
constructor(db){
this.db=db;
}
insert(monkey){
}
update(monkey){
}
delete(monkey){
}
findAll(){
}
findById(id){
}
}
\ No newline at end of file
class SpeciesDbDAO{
constructor(db){
this.db=db
}
insert(species){
}
update(species){
}
delete(species){
}
findAll(){
}
findById(id){
}
}
\ No newline at end of file
import MonkeyDbDAO from "../DAO/MonkeyDbDAO.js";
import SpeciesDbDAO from "../DAO/SpeciesDbDAO.js";
class DAODbFactory {
constructor() {
this.db = null;
}
createMonkeyDAO() {
// Code pour créer et retourner une instance de MonkeyDAO
return MonkeyDbDAO
}
createSpeciesDAO() {
// Code pour créer et retourner une instance de TimingDAO
return SpeciesDbDAO
}
getConnection() {
// Code pour établir une connexion à la base de données et la retourner
}
}
import MonkeyDbDAO from "../DAO/MonkeyDbDAO.js";
import SpeciesDbDAO from "../DAO/SpeciesDbDAO.js";
class DAOFactory {
createMonkeyDAO(){
return new MonkeyDAO(this.getConnection())
}
createSpeciesDAO(){
return new SpeciesDAO(this.getConnection())
}
}
\ No newline at end of file
class Monkey {
constructor(id, name, speciesId, sex, age, birthLoc, liveLoc) {
this.id = id;
this.name = name;
this.speciesId = speciesId;
this.sex = sex;
this.age = age;
this.birthLoc = birthLoc;
this.liveLoc = liveLoc;
}
getId() {
return this.id;
}
getName() {
return this.name;
}
getSpeciesId() {
return this.speciesId;
}
getSex() {
return this.sex;
}
getAge() {
return this.age;
}
getBirthLoc() {
return this.birthLoc;
}
getLiveLoc() {
return this.liveLoc;
}
}
\ No newline at end of file
class Species {
constructor(id, name, habitat, height, weight, diet) {
this.id = id;
this.name = name;
this.habitat = habitat;
this.height = height;
this.weight = weight;
this.diet = diet;
this.monkeys = [];
}
getId() {
return this.id;
}
getName() {
return this.name;
}
getHabitat() {
return this.habitat;
}
getHeight() {
return this.height;
}
getWeight() {
return this.weight;
}
getDiet() {
return this.diet;
}
addMonkey(monkey) {
this.monkeys.push(monkey);
}
getMonkeys() {
return this.monkeys;
}
}
\ No newline at end of file