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
No results found
Select Git revision
  • main
1 result
Show changes

Commits on Source 2

11 files
+ 5216
0
Compare changes
  • Side-by-side
  • Inline

Files

.gitignore

0 → 100644
+1 −0
Original line number Diff line number Diff line
node_modules

index.js

0 → 100644
+0 −0
Original line number Diff line number Diff line
+28 −0
Original line number Diff line number Diff line
--------------------------------------------------------------------------------
-- 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

package-lock.json

0 → 100644
+4997 −0

File added.

Preview size limit exceeded, changes collapsed.

package.json

0 → 100644
+22 −0
Original line number Diff line number Diff line
{
  "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"
  }
}

src/DAO/MonkeyDbDAO.js

0 → 100644
+25 −0
Original line number Diff line number Diff line
class MonkeyDbDAO{
    constructor(db){
        this.db=db;
    }

    insert(monkey){

    }

    update(monkey){

    }

    delete(monkey){

    }

    findAll(){

    }

    findById(id){

    }
}
 No newline at end of file
+24 −0
Original line number Diff line number Diff line
class SpeciesDbDAO{
    constructor(db){
        this.db=db
    }
    insert(species){

    }

    update(species){

    }

    delete(species){

    }

    findAll(){

    }

    findById(id){

    }
}
 No newline at end of file
+24 −0
Original line number Diff line number Diff line
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
    }
}
+13 −0
Original line number Diff line number Diff line
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

src/models/monkey.js

0 → 100644
+39 −0
Original line number Diff line number Diff line
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

src/models/species.js

0 → 100644
+43 −0
Original line number Diff line number Diff line
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