From d9b5a5df8c4436f9391789a01facc2028830979f Mon Sep 17 00:00:00 2001 From: chriswebb09 Date: Mon, 18 Dec 2023 17:47:52 -0500 Subject: [PATCH] update file structure --- .../blueprints/reports/reportbp.py | 30 ++----------------- .../static/js/{ => list}/listcomponents.js | 0 .../templates/team/teamreport.html | 4 +++ DirectReport/models/Report/team_member.py | 0 .../models/{ => Report}/team_member_model.py | 2 +- DirectReport/models/entry/__init__.py | 0 DirectReport/models/{ => entry}/entry.py | 0 .../models/{ => entry}/entry_storage.py | 2 +- DirectReport/models/list_builder.py | 4 +-- DirectReport/models/team/__init__.py | 0 DirectReport/models/{ => team}/team.py | 0 DirectReport/models/{ => team}/team_model.py | 2 +- DirectReport/models/team_member.py | 11 ------- DirectReport/tests/test_db.py | 4 +-- DirectReport/tests/test_model.py | 3 -- 15 files changed, 14 insertions(+), 48 deletions(-) rename DirectReport/browserview/static/js/{ => list}/listcomponents.js (100%) create mode 100644 DirectReport/models/Report/team_member.py rename DirectReport/models/{ => Report}/team_member_model.py (95%) create mode 100644 DirectReport/models/entry/__init__.py rename DirectReport/models/{ => entry}/entry.py (100%) rename DirectReport/models/{ => entry}/entry_storage.py (98%) create mode 100644 DirectReport/models/team/__init__.py rename DirectReport/models/{ => team}/team.py (100%) rename DirectReport/models/{ => team}/team_model.py (96%) delete mode 100644 DirectReport/models/team_member.py diff --git a/DirectReport/browserview/blueprints/reports/reportbp.py b/DirectReport/browserview/blueprints/reports/reportbp.py index 04ce1fe2..eaa16c21 100644 --- a/DirectReport/browserview/blueprints/reports/reportbp.py +++ b/DirectReport/browserview/blueprints/reports/reportbp.py @@ -6,8 +6,6 @@ from DirectReport.browserview.services.github import GithubClient from DirectReport.browserview.services.github import GoogleAIClient -from DirectReport.models.entry_storage import EntryStorage -from DirectReport.models.list_builder import ListBuilder from DirectReport.models.Report.report_builder import ReportBuilder from DirectReport.models.Report.report_model import ReportModel @@ -42,7 +40,7 @@ def report(): } data_json["shortlog"] = client.parse_git_shortlog(log_item) data_json["repos"] = repodata - ReportBuilder.new(data_json, prompt, current_user.id, "DirectReport") + ReportBuilder.new(data_json, prompt, current_user.id) return data_json, 201 @@ -56,35 +54,13 @@ def team_report(): return render_template('team/teamreport.html', title='Team Report', data=[]) -@reportsbp.route('/entry/', methods=['GET', 'POST']) -@login_required -def detail(uid=None): - """ - Retrieves and renders the details of a specific entry. - - :param uid: The ID of the entry to display. - :return: Rendered HTML template for the entry details page. - """ - reports = ReportBuilder.get_reports_for_user_id(current_user.id) - report = list(filter(lambda report: report["uuid"] == uid, reports))[0] - json.loads(json.dumps(report)) - item = EntryStorage('SQLite_Python.db') - if request.method == "POST": - json_data = request.get_json() - ListBuilder.update( - json_data["id"], json_data['entry'], json_data['topic'], json_data['created_at'], json_data['week_id'] - ) - entry = item.get_entry(uid).to_dict() - print(entry) - return render_template('detail.html', title='Detail', data=entry) - - @reportsbp.route("/getreport/", methods=['GET']) @login_required def get_report(uid=None): reports = ReportBuilder.get_reports_for_user_id(current_user.id) report = list(filter(lambda report: report["uuid"] == uid, reports))[0] - return report, 201 + print(report["report"]) + return render_template('team/teamreport.html', title='Team Report', teamData=report["report"]) @reportsbp.route("/getlist", methods=['GET']) diff --git a/DirectReport/browserview/static/js/listcomponents.js b/DirectReport/browserview/static/js/list/listcomponents.js similarity index 100% rename from DirectReport/browserview/static/js/listcomponents.js rename to DirectReport/browserview/static/js/list/listcomponents.js diff --git a/DirectReport/browserview/templates/team/teamreport.html b/DirectReport/browserview/templates/team/teamreport.html index c660ff57..d23faa10 100644 --- a/DirectReport/browserview/templates/team/teamreport.html +++ b/DirectReport/browserview/templates/team/teamreport.html @@ -7,6 +7,10 @@ {% block content %}
+ diff --git a/DirectReport/models/Report/team_member.py b/DirectReport/models/Report/team_member.py new file mode 100644 index 00000000..e69de29b diff --git a/DirectReport/models/team_member_model.py b/DirectReport/models/Report/team_member_model.py similarity index 95% rename from DirectReport/models/team_member_model.py rename to DirectReport/models/Report/team_member_model.py index 416f9686..ffc3606d 100644 --- a/DirectReport/models/team_member_model.py +++ b/DirectReport/models/Report/team_member_model.py @@ -2,7 +2,7 @@ import sqlite3 import uuid -from .team_member import TeamMember +from DirectReport.models.Report.team_member import TeamMember class TeamMemberModel: diff --git a/DirectReport/models/entry/__init__.py b/DirectReport/models/entry/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/DirectReport/models/entry.py b/DirectReport/models/entry/entry.py similarity index 100% rename from DirectReport/models/entry.py rename to DirectReport/models/entry/entry.py diff --git a/DirectReport/models/entry_storage.py b/DirectReport/models/entry/entry_storage.py similarity index 98% rename from DirectReport/models/entry_storage.py rename to DirectReport/models/entry/entry_storage.py index 33ca215e..5c4fe565 100644 --- a/DirectReport/models/entry_storage.py +++ b/DirectReport/models/entry/entry_storage.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import sqlite3 -from DirectReport.models.entry import Entry +from DirectReport.models.entry.entry import Entry class EntryStorage: diff --git a/DirectReport/models/list_builder.py b/DirectReport/models/list_builder.py index 9541c51e..a00bbb97 100644 --- a/DirectReport/models/list_builder.py +++ b/DirectReport/models/list_builder.py @@ -2,8 +2,8 @@ import datetime import uuid -from DirectReport.models.entry import Entry -from DirectReport.models.entry_storage import EntryStorage +from DirectReport.models.entry.entry import Entry +from DirectReport.models.entry.entry_storage import EntryStorage class ListBuilder: diff --git a/DirectReport/models/team/__init__.py b/DirectReport/models/team/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/DirectReport/models/team.py b/DirectReport/models/team/team.py similarity index 100% rename from DirectReport/models/team.py rename to DirectReport/models/team/team.py diff --git a/DirectReport/models/team_model.py b/DirectReport/models/team/team_model.py similarity index 96% rename from DirectReport/models/team_model.py rename to DirectReport/models/team/team_model.py index b7456c25..98ab8c73 100644 --- a/DirectReport/models/team_model.py +++ b/DirectReport/models/team/team_model.py @@ -2,7 +2,7 @@ import sqlite3 import uuid -from .team import Team +from DirectReport.models.team.team import Team class TeamModel: diff --git a/DirectReport/models/team_member.py b/DirectReport/models/team_member.py deleted file mode 100644 index fe592d23..00000000 --- a/DirectReport/models/team_member.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python3 - -import sqlite3 -import uuid - - -class TeamMember: - def __init__(self, id, team_id, username): - self.id = id - self.team_id = team_id - self.username = username diff --git a/DirectReport/tests/test_db.py b/DirectReport/tests/test_db.py index ab2af35f..2cd19b7a 100644 --- a/DirectReport/tests/test_db.py +++ b/DirectReport/tests/test_db.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 -from DirectReport.models.entry import Entry -from DirectReport.models.entry_storage import EntryStorage +from DirectReport.models.entry.entry import Entry +from DirectReport.models.entry.entry_storage import EntryStorage from datetime import datetime from pathlib import Path import tempfile diff --git a/DirectReport/tests/test_model.py b/DirectReport/tests/test_model.py index a3106c94..63f77b6b 100644 --- a/DirectReport/tests/test_model.py +++ b/DirectReport/tests/test_model.py @@ -1,5 +1,2 @@ #!/usr/bin/env python3 -from DirectReport.models.entry import Entry -import datetime -import uuid