Skip to content

Commit

Permalink
feat: add model project metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Bidaya0 committed Aug 1, 2023
1 parent 84f4d20 commit e6e4083
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
30 changes: 30 additions & 0 deletions dongtai_common/migrations/0005_iastprojectmetadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated by Django 3.2.20 on 2023-08-01 11:33

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

Check failure on line 7 in dongtai_common/migrations/0005_iastprojectmetadata.py

View workflow job for this annotation

GitHub Actions / Run-RuffCheck

Ruff (I001)

dongtai_common/migrations/0005_iastprojectmetadata.py:3:1: I001 Import block is un-sorted or un-formatted

dependencies = [
('dongtai_common', '0004_auto_20230731_1556'),

Check failure on line 10 in dongtai_common/migrations/0005_iastprojectmetadata.py

View workflow job for this annotation

GitHub Actions / Run-RuffCheck

Ruff (Q000)

dongtai_common/migrations/0005_iastprojectmetadata.py:10:10: Q000 Single quotes found but double quotes preferred

Check failure on line 10 in dongtai_common/migrations/0005_iastprojectmetadata.py

View workflow job for this annotation

GitHub Actions / Run-RuffCheck

Ruff (Q000)

dongtai_common/migrations/0005_iastprojectmetadata.py:10:28: Q000 Single quotes found but double quotes preferred
]

operations = [
migrations.CreateModel(
name='IastProjectMetaData',

Check failure on line 15 in dongtai_common/migrations/0005_iastprojectmetadata.py

View workflow job for this annotation

GitHub Actions / Run-RuffCheck

Ruff (Q000)

dongtai_common/migrations/0005_iastprojectmetadata.py:15:18: Q000 Single quotes found but double quotes preferred
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),

Check failure on line 17 in dongtai_common/migrations/0005_iastprojectmetadata.py

View workflow job for this annotation

GitHub Actions / Run-RuffCheck

Ruff (Q000)

dongtai_common/migrations/0005_iastprojectmetadata.py:17:18: Q000 Single quotes found but double quotes preferred

Check failure on line 17 in dongtai_common/migrations/0005_iastprojectmetadata.py

View workflow job for this annotation

GitHub Actions / Run-RuffCheck

Ruff (Q000)

dongtai_common/migrations/0005_iastprojectmetadata.py:17:108: Q000 Single quotes found but double quotes preferred
('api_count', models.IntegerField(default=0, help_text='API数量统计')),

Check failure on line 18 in dongtai_common/migrations/0005_iastprojectmetadata.py

View workflow job for this annotation

GitHub Actions / Run-RuffCheck

Ruff (Q000)

dongtai_common/migrations/0005_iastprojectmetadata.py:18:18: Q000 Single quotes found but double quotes preferred

Check failure on line 18 in dongtai_common/migrations/0005_iastprojectmetadata.py

View workflow job for this annotation

GitHub Actions / Run-RuffCheck

Ruff (Q000)

dongtai_common/migrations/0005_iastprojectmetadata.py:18:72: Q000 Single quotes found but double quotes preferred
('vul_api_count', models.IntegerField(default=0, help_text='漏洞API数量统计')),

Check failure on line 19 in dongtai_common/migrations/0005_iastprojectmetadata.py

View workflow job for this annotation

GitHub Actions / Run-RuffCheck

Ruff (Q000)

dongtai_common/migrations/0005_iastprojectmetadata.py:19:18: Q000 Single quotes found but double quotes preferred

Check failure on line 19 in dongtai_common/migrations/0005_iastprojectmetadata.py

View workflow job for this annotation

GitHub Actions / Run-RuffCheck

Ruff (Q000)

dongtai_common/migrations/0005_iastprojectmetadata.py:19:76: Q000 Single quotes found but double quotes preferred
('create_at', models.DateTimeField(auto_now_add=True, null=True)),
('update_at', models.DateTimeField(auto_now=True, null=True)),
('project', models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.CASCADE, to='dongtai_common.iastproject')),
('project_version', models.ForeignKey(blank=True, db_constraint=False, default=-1, on_delete=django.db.models.deletion.DO_NOTHING, to='dongtai_common.iastprojectversion')),
],
options={
'db_table': 'iast_project_meta_data',
'managed': True,
},
),
]
1 change: 1 addition & 0 deletions dongtai_common/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from .user import User # noqa: I001, F401
from . import api_route # noqa: F401
from .project_group import IastProjectGroup # noqa: F401
from .project_metadata import IastProjectMetaData # noqa: F401

LANGUAGE_DICT = {"JAVA": 1, "PYTHON": 2, "PHP": 3, "GO": 4}
# aggregation
Expand Down
6 changes: 4 additions & 2 deletions dongtai_common/models/project_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@


class IastProjectMetaData(models.Model):
project = models.ForeignKey(IastProject, models.CASCADE)
project_version = models.ForeignKey(IastProjectVersion, on_delete=models.DO_NOTHING, blank=True, default=-1)
project = models.ForeignKey(IastProject, models.CASCADE, db_constraint=False)
project_version = models.ForeignKey(
IastProjectVersion, on_delete=models.DO_NOTHING, blank=True, default=-1, db_constraint=False
)
api_count = models.IntegerField(help_text="API数量统计", default=0)
vul_api_count = models.IntegerField(help_text="漏洞API数量统计", default=0)
create_at = models.DateTimeField(auto_now_add=True, blank=True, null=True)
Expand Down

0 comments on commit e6e4083

Please sign in to comment.