Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions backend/database/schemas.ql

This file was deleted.

11 changes: 11 additions & 0 deletions backend/database/schemas.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*==================HEALTHCONNECT-SCHEMA DE BASE DE DONNEES==========*/
/*==================Table Users==============*/
CREATE TABLE User(id SERIAL PRIMARY KEY,nom VARCHAR(100) NOT NULL,email VARCHAR(100) UNIQUE NOT NULL, motdepasse VARCHAR(255)NOT NULL,role VARCHAR(20) NOT NULL/*Patient,Docteur,Admin*/);
/*==================Table Docteur=============*/
CREATE TABLE Docteur(id SERIAL PRIMARY KEY,User_id INT UNIQUE REFERENCES Users(id) ON DELETE CASCADE, specialite VARCHAR(100) NOT NULL,avaliability VARCHAR(100));
/*==================Table Rendez-vous=============*/
CREATE TABLE Appointment(id SERIAL PRIMARY KEY,patient_id INT REFERENCES Users(id) ON DELETE CASCADE,docteur_id INT REFERENCES docteur(id) ON DELETE CASCADE, date TIMESTAMP NOT NULL, status VARCHAR(20) DEFAULT 'En attente');
/*==================Table NOTIFICATIONS=============*/
CREATE TABLE Notification(id SERIAL PRIMARY KEY, User_id INT REFERENCES Users(id) ON DELETE CASCADE, type VARCHAR(20),message TEXT, sent_at TIMESTAMP,status VARCHAR(20));
/*==================Table Admin=============*/
CREATE TABLE Admin(id SERIAL PRIMARY KEY, User_id INT UNIQUE REFERENCES User(id) ON DELETE CASCADE);
11 changes: 11 additions & 0 deletions backend/modeles/Admin.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { DataTypes } = require("pool");
const pool = require ("C:\Users\User\Documents\GitHub\HealthConnect\backend\config\db.js");
const User = require ("C:\Users\User\Documents\GitHub\HealthConnect\backend\modeles\User.model.js");
const Admin = pool.define("Admin",
{
id: {type: DataTypes.INTEGER,primaryKey: true,autoIncrement: true},
},
{tableName: "Admin",timestamps: false}
);
Admin.belongsTo(User, { foreignKey: "User_id"});
module.exports = Admin;
15 changes: 15 additions & 0 deletions backend/modeles/Appointment.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { DataTypes } = require("pool");
const pool = require ("C:\Users\User\Documents\GitHub\HealthConnect\backend\config\db.js");
const User = require ("C:\Users\User\Documents\GitHub\HealthConnect\backend\modeles\User\User.model.js");
const Docteur = require ("C:\Users\User\Documents\GitHub\HealthConnect\backend\modeles\Docteur.model.js");
const Appointment = pool.define("Appointment",
{
id: {type: DataTypes.INTEGER,primaryKey: true,autoIncrement: true},
date:{ type: DataTypes.DATE,allowNull: false},
status: {type: DataTypes.STRING(20),defaultvalue: "En attente"}
},
{tableName: "Appointment",timestamps: false}
);
Appointment.belongsTo(User, { foreignKey:"patient_id"});
Appointment.belongsTo(Docteur, { foreignKey:"docteur_id"});
module.exports = Appointment;
13 changes: 13 additions & 0 deletions backend/modeles/Docteur.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { DataTypes } = require("pool");
const pool = require ("C:\Users\User\Documents\GitHub\HealthConnect\backend\config\db.js");
const User = require ("C:\Users\User\Documents\GitHub\HealthConnect\backend\modeles\User.model.js");
const Docteur = pool.define("Docteur",
{
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
specialite: { type: DataType.STRING(100), allowNull: false },
avaliability: { type: DataTypes.STRING(100)}
},
{tableName: "Docteur",timestamps: false}
);
Doctor.belongsTo(User, { foreignkey: "User_id"});
module.exports = Docteur;
16 changes: 16 additions & 0 deletions backend/modeles/Notification.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { DataTypes } = require("pool");
const pool = require ("C:\Users\User\Documents\GitHub\HealthConnect\backend\config\db.js");
const User = require ("C:\Users\User\Documents\GitHub\HealthConnect\backend\modeles\User.model.js");
const Notification = pool.define(" Notification",
{
id: {type: DataTypes.INTEGER,primaryKey: true,autoIncrement: true},
type: {type: DataTypes.STRING(20)},
message:{ type: DataTypes.TEXT},
sent_at:{type: DataTypes.DATE},
status: {type: DataTypes.STRING(20)}
},
{tableName: "Notification",timestamps: false}
);
Notification.belongsTo(User, { foreignKey: "User_id"});
User.hasMany(Notification,{ foreignKey:"User_id"});
module.exports = Notification;
13 changes: 13 additions & 0 deletions backend/modeles/User.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { DataTypes } = require("pool");
const pool = require ("C:\Users\User\Documents\GitHub\HealthConnect\backend\config\db.js");
const User = pool.define("User",
{
id: {type: DataTypes.INTEGER,primaryKey: true,autoIncrement: true },
nom: {type: DataTypes.STRING(100), allowNull: false },
email: {type: DataTypes.STRING(100), allowNull: false, unique: true },
motdepasse: {type: DataTypes.STRING(255), allowNull: false },
role: {type: DataTypes.STRING(20), allowNull: false }
},
{tableName: "User",timestamps: false}
);
module.exports = User;
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,15 @@
"dotenv": "^17.2.3",
"express": "^5.2.1",
"pg": "^8.18.0"
}
},
"devDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/IRAGAME/HealthConnect.git"
},
"keywords": [],
"bugs": {
"url": "https://github.com/IRAGAME/HealthConnect/issues"
},
"homepage": "https://github.com/IRAGAME/HealthConnect#readme"
}