diff --git a/.releaserc.toml b/.releaserc.toml index b7aa5b6..342863a 100644 --- a/.releaserc.toml +++ b/.releaserc.toml @@ -1,5 +1,6 @@ [tool.semantic_release] branch = "main" +version_source = "variable" version_variable = "setup.py:__version__" commit_message = "chore(release): create new version {version}" -github_token = "${GH_TOKEN}" \ No newline at end of file +github_token = "${GH_TOKEN}" diff --git a/CHANGELOG.md b/CHANGELOG.md index dc2cd22..8fdcc2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,159 @@ # CHANGELOG +## v0.10.2 (2025-04-02) + +### Bug Fixes + +- Modification de la CI pour les upgrades + ([`ab23312`](https://github.com/DEPSEC-Project/DB-Management/commit/ab23312e0df5d49b1b3ef6f0c312bd4d7d472f2a)) + + +## v0.10.1 (2025-04-02) + +### Bug Fixes + +- Migration sbom id peut etre null + ([`0c64b3d`](https://github.com/DEPSEC-Project/DB-Management/commit/0c64b3d4000b49df7fa8e0933ac4a15a5be9297a)) + + +## v0.10.0 (2025-04-02) + +### Features + +- **ci**: Modif des migrations selon la branche + ([`02499e4`](https://github.com/DEPSEC-Project/DB-Management/commit/02499e4daacfffb94c571b610c780a53c38ed5bf)) + + +## v0.9.0 (2025-04-02) + +### Bug Fixes + +- **error**: Missing-function-docstring + ([`6a92a2e`](https://github.com/DEPSEC-Project/DB-Management/commit/6a92a2e2809acce58d3bf4b51f5dc434c66780fb)) + +### Features + +- **create_function**: Cette fonction permet de retourner tous les projets + ([`e9b37f7`](https://github.com/DEPSEC-Project/DB-Management/commit/e9b37f7a1faead253f0486572349dd5362f322bb)) + + +## v0.8.0 (2025-04-02) + +### Features + +- **trivyreport**: Ajout d'une clé étrangère pour id_sbom de trivyreport avec la table SBOM + ([`34ca141`](https://github.com/DEPSEC-Project/DB-Management/commit/34ca141e5d3bc183aa4e96e59832d87c566318fd)) + + +## v0.7.1 (2025-04-02) + +### Bug Fixes + +- **name_class**: Des trucs + ([`64b78a8`](https://github.com/DEPSEC-Project/DB-Management/commit/64b78a80f673e148acbd0dc223d8428f09a2be53)) + + +## v0.7.0 (2025-04-02) + +### Bug Fixes + +- **bdd**: Pb et tout quoi des choses + ([`39509bb`](https://github.com/DEPSEC-Project/DB-Management/commit/39509bb0d9467c3eeb276771c63470707789aa79)) + +- **bdd**: Ya un truc qui marchait pas du coup et voila + ([`943eeba`](https://github.com/DEPSEC-Project/DB-Management/commit/943eeba872894d19ca88246ea32a98a1a87ea3bd)) + +### Features + +- **model**: Ajout du modele des projets + ([`7533b8a`](https://github.com/DEPSEC-Project/DB-Management/commit/7533b8a448b19c279ede6a222cc66b8e0fab79c7)) + + +## v0.6.0 (2025-04-02) + +### Bug Fixes + +- Fix du problème pylint louche + ([`6ad0b7c`](https://github.com/DEPSEC-Project/DB-Management/commit/6ad0b7c75162d08ed22960479d19413ccc838ddd)) + +- La j'ai 10/10 + ([`c232f4d`](https://github.com/DEPSEC-Project/DB-Management/commit/c232f4d36d2486f9e93c093a5f9dcdd88dc7e2b8)) + +- Longueur de la ligne + ([`94c0c88`](https://github.com/DEPSEC-Project/DB-Management/commit/94c0c887d04971ab3ab03d5b08e3243564258088)) + +- Maj des fichiers workflow dev.yml et master.yml + ([`041bfa4`](https://github.com/DEPSEC-Project/DB-Management/commit/041bfa4b6d9da2f7205525849551222e190afa42)) + +- Model TrivyReport contenait une variable deja utilisée + ([`029c2bd`](https://github.com/DEPSEC-Project/DB-Management/commit/029c2bd4e111f038a34b7163f4777fdfd1ef2ad6)) + +- Models + ([`7445bcc`](https://github.com/DEPSEC-Project/DB-Management/commit/7445bccd9c89a86b5d43243a6f52f40ec228ef89)) + +- Not callable + ([`e5ba63f`](https://github.com/DEPSEC-Project/DB-Management/commit/e5ba63ff72b83dca2a9fa8ec3f8d095f7cd9b683)) + +- Not callable (bug pylint) + ([`9d785d1`](https://github.com/DEPSEC-Project/DB-Management/commit/9d785d17ff18f4f093cd83a7a4702db77e6d0af7)) + +- Pour avoir 10/10 avec pylint + ([`31536e2`](https://github.com/DEPSEC-Project/DB-Management/commit/31536e2a8a1787e0221fc54f33c25922fd53fab9)) + +- Pylint + ([`0f36fad`](https://github.com/DEPSEC-Project/DB-Management/commit/0f36fad9ddac40d9c222528b94d102e1a25e296e)) + +### Features + +- Ajout du model du rapport Trivy + ([`5e449dd`](https://github.com/DEPSEC-Project/DB-Management/commit/5e449ddc5c0ca9dbf4a136287fccf17d07ca9441)) + +- **auth**: Ajout des modèles d'user / blacklistToken + ([`1d2fc7f`](https://github.com/DEPSEC-Project/DB-Management/commit/1d2fc7f660163ba8fbf699f0c228474cdeafc22c)) + +### Testing + +- Migration BDD + ([`59c06c0`](https://github.com/DEPSEC-Project/DB-Management/commit/59c06c0a93f3075995fbf97dba2219fd16281a1b)) + +- Migration BDD + ([`1abe6df`](https://github.com/DEPSEC-Project/DB-Management/commit/1abe6df06ff73240e37eb5f7bc7630661b209e85)) + +- Migration BDD + ([`1e1002b`](https://github.com/DEPSEC-Project/DB-Management/commit/1e1002b33b264f9d601ce357ea74f9853d6424a7)) + +- Migration BDD + ([`c3cb0e9`](https://github.com/DEPSEC-Project/DB-Management/commit/c3cb0e9519c8af03b278d96429e79c132fc238e1)) + +- Migration BDD + ([`f6ea447`](https://github.com/DEPSEC-Project/DB-Management/commit/f6ea447670b4c68b4408adaeec66a3fbf44222c3)) + +- Migration BDD + ([`e577de7`](https://github.com/DEPSEC-Project/DB-Management/commit/e577de7c4fcb88bb1eb813e44608ad6bf974b5db)) + +- Migration de la BDD + ([`feabc6d`](https://github.com/DEPSEC-Project/DB-Management/commit/feabc6d2d027a66ae4324d3028bf2091cdca3080)) + +- Migration de la bdd sur le serveur portainer + ([`10a3842`](https://github.com/DEPSEC-Project/DB-Management/commit/10a3842fbe210bdf78e01575084db2acf9a95b58)) + +- Migration de la BDD test n°2 + ([`759f62e`](https://github.com/DEPSEC-Project/DB-Management/commit/759f62ef85b38708804e75e99ffc73e3df5ac915)) + +- Migration de la BDD test n°3 + ([`e8ee1c4`](https://github.com/DEPSEC-Project/DB-Management/commit/e8ee1c452aebf885a973da0e307a05f6c76e0f87)) + +- Migration de la BDD vers le serveur portainer + ([`26ef818`](https://github.com/DEPSEC-Project/DB-Management/commit/26ef8186c37f98247d303876e5cdf875e516ea2b)) + +- Réparation semantic-release + ([`b9b5bca`](https://github.com/DEPSEC-Project/DB-Management/commit/b9b5bca5911d0c0d18d88e0eca5316074b11d438)) + +- Test de la migratiuon de la BDD sur le serveur portainer + ([`0f27967`](https://github.com/DEPSEC-Project/DB-Management/commit/0f27967f1c41264570393f52dc45534e052f1fcc)) + + ## v0.5.0 (2025-03-24) ### Bug Fixes @@ -9,7 +162,7 @@ ([`4894e16`](https://github.com/DEPSEC-Project/DB-Management/commit/4894e16261b1dbd74614ee9a92a378bedc227d1d)) - **ci**: Désactivation des warnings dans pylint - ([`f66ccc5`](https://github.com/DEPSEC-Project/DB-Management/commit/f66ccc5f1fbfb3f46a61d2526594430ec79649d9)) + ([`f66ccc5`](https://github.com/DEPSEC-Project/DB-Management/commit/f66ccc5f1fbfb3f46a61d2526594430ec79649d9)) - **ci**: Modification de master.yml ([`fee2131`](https://github.com/DEPSEC-Project/DB-Management/commit/fee213137cc5e643cc8d9f92940f3393bc51b880)) diff --git a/README.md b/README.md index 76f8b28..4957a52 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ Objectifs: - Permettre l'importation de ces modèles pour les microservices Package gérant la mise à jour de la BDD ainsi que tous les modèles. -ca -Pour récupérer le package (et pour ainsi dire les modèles): +c +Pour récupérer le package (et pour ainsi dire les modèles): ```bash pip install --no-cache-dir --index-url https://pypi.org/simple git+https://github.com/DEPSEC-Project/DB-Management.git ``` diff --git a/depsec_db/models.py b/depsec_db/models.py index 0106a87..87281d3 100644 --- a/depsec_db/models.py +++ b/depsec_db/models.py @@ -5,8 +5,14 @@ """ import uuid + +from sqlalchemy import ( + ForeignKey, + func as sa_func +) +from sqlalchemy.orm import relationship from werkzeug.security import generate_password_hash, check_password_hash -from sqlalchemy import func as sa_func + from depsec_db.extensions import db class Project(db.Model): @@ -18,6 +24,8 @@ class Project(db.Model): titre = db.Column(db.String, nullable=False) status = db.Column(db.String, nullable=False) path = db.Column(db.String, nullable=False) + """Relation avec SBOM : suppression en cascade""" + sboms = relationship("SBOM", backref="project", cascade="all, delete", passive_deletes=True) def to_dict(self): """Function to return projects as JSON""" return { @@ -109,7 +117,8 @@ class SBOM(db.Model): """ __tablename__ = 'sboms' id = db.Column(db.Integer, primary_key=True, autoincrement=True) - project_id = db.Column(db.Integer, db.ForeignKey('projects.id'), nullable=False) + """Clé étrangère vers l'id du projet""" + project_id = db.Column(db.Integer, ForeignKey('projects.id',ondelete="CASCADE"),nullable=False) sbom_data = db.Column(db.JSON, nullable=False) """Relation One-To-Many avec la table TrivyReport qui utilise l'id du SBOM""" projects = db.relationship('TrivyReport', backref='sboms', lazy=True) diff --git a/setup.py b/setup.py index d0ec43a..1f42233 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ """ from setuptools import find_packages, setup -__version__ ="0.5.0" +__version__ ="0.9.0" setup( name="depsec_models", version=__version__,