zou 0.20.61__py3-none-any.whl → 0.20.62__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- zou/__init__.py +1 -1
- zou/app/api.py +2 -0
- zou/app/blueprints/crud/__init__.py +25 -1
- zou/app/blueprints/crud/hardware_item.py +12 -0
- zou/app/blueprints/crud/notification.py +0 -4
- zou/app/blueprints/crud/production_schedule_version.py +114 -0
- zou/app/blueprints/departments/__init__.py +35 -0
- zou/app/blueprints/departments/resources.py +262 -0
- zou/app/blueprints/index/resources.py +2 -9
- zou/app/blueprints/persons/resources.py +1 -3
- zou/app/blueprints/projects/__init__.py +20 -0
- zou/app/blueprints/projects/resources.py +200 -0
- zou/app/blueprints/tasks/resources.py +5 -2
- zou/app/blueprints/user/resources.py +1 -3
- zou/app/models/base.py +15 -4
- zou/app/models/department.py +62 -0
- zou/app/models/entity.py +3 -3
- zou/app/models/hardware_item.py +15 -0
- zou/app/models/person.py +1 -1
- zou/app/models/production_schedule_version.py +81 -0
- zou/app/models/project.py +17 -6
- zou/app/models/software.py +5 -1
- zou/app/models/task.py +7 -10
- zou/app/services/assets_service.py +5 -6
- zou/app/services/concepts_service.py +3 -4
- zou/app/services/deletion_service.py +10 -18
- zou/app/services/departments_service.py +153 -0
- zou/app/services/edits_service.py +3 -4
- zou/app/services/entities_service.py +5 -6
- zou/app/services/exception.py +8 -0
- zou/app/services/file_tree_service.py +2 -2
- zou/app/services/preview_files_service.py +6 -2
- zou/app/services/schedule_service.py +243 -1
- zou/app/services/shots_service.py +3 -4
- zou/app/services/tasks_service.py +5 -1
- zou/app/services/user_service.py +57 -23
- zou/migrations/alembic.ini +1 -1
- zou/migrations/versions/0bd1e89f2a6f_add_productionscheduleversiontasklink_uc.py +58 -0
- zou/migrations/versions/26f96f65cfa3_add_productionversionschedule_uc.py +40 -0
- zou/migrations/versions/3d8e68dffeee_fix_task_person_link.py +56 -0
- zou/migrations/versions/4368137b44e1_productionscheduleversion_add_on_delete_.py +188 -0
- zou/migrations/versions/4bd9bfb73f11_add_fields_to_the_software_table.py +49 -0
- zou/migrations/versions/5f715f2b6348_add_new_table_productionscheduleversion.py +128 -0
- zou/migrations/versions/7a16258f2fab_add_currency_field_to_budgets.py +2 -4
- zou/migrations/versions/9683bd840dee_add_archived_field_to_software.py +33 -0
- zou/migrations/versions/9af2df17a9d5_add_hardware_table.py +48 -0
- zou/migrations/versions/ce7f46f445dc_add_column_estimation_for_.py +37 -0
- zou/migrations/versions/d5665dca188b_add_version_field_to_software.py +35 -0
- zou/migrations/versions/d97f2730bf7b_add_.py +101 -0
- zou/migrations/versions/dde6be40f54f_add_departement_links_tables_for_.py +151 -0
- zou/migrations/versions/e4b48ca33539_add_project_production_schedule_version_.py +56 -0
- zou/migrations/versions/e8bc24998b34_remove_on_delete_cascade_for_.py +59 -0
- {zou-0.20.61.dist-info → zou-0.20.62.dist-info}/METADATA +1 -1
- {zou-0.20.61.dist-info → zou-0.20.62.dist-info}/RECORD +58 -37
- {zou-0.20.61.dist-info → zou-0.20.62.dist-info}/WHEEL +0 -0
- {zou-0.20.61.dist-info → zou-0.20.62.dist-info}/entry_points.txt +0 -0
- {zou-0.20.61.dist-info → zou-0.20.62.dist-info}/licenses/LICENSE +0 -0
- {zou-0.20.61.dist-info → zou-0.20.62.dist-info}/top_level.txt +0 -0
zou/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.20.
|
|
1
|
+
__version__ = "0.20.62"
|
zou/app/api.py
CHANGED
|
@@ -6,6 +6,7 @@ from zou.app.blueprints.breakdown import blueprint as breakdown_blueprint
|
|
|
6
6
|
from zou.app.blueprints.chats import blueprint as chats_blueprint
|
|
7
7
|
from zou.app.blueprints.comments import blueprint as comments_blueprint
|
|
8
8
|
from zou.app.blueprints.crud import blueprint as crud_blueprint
|
|
9
|
+
from zou.app.blueprints.departments import blueprint as departments_blueprint
|
|
9
10
|
from zou.app.blueprints.entities import blueprint as entities_blueprint
|
|
10
11
|
from zou.app.blueprints.events import blueprint as events_blueprint
|
|
11
12
|
from zou.app.blueprints.export import blueprint as export_blueprint
|
|
@@ -51,6 +52,7 @@ def configure_api_routes(app):
|
|
|
51
52
|
app.register_blueprint(chats_blueprint)
|
|
52
53
|
app.register_blueprint(comments_blueprint)
|
|
53
54
|
app.register_blueprint(crud_blueprint)
|
|
55
|
+
app.register_blueprint(departments_blueprint)
|
|
54
56
|
app.register_blueprint(entities_blueprint)
|
|
55
57
|
app.register_blueprint(export_blueprint)
|
|
56
58
|
app.register_blueprint(events_blueprint)
|
|
@@ -98,6 +98,10 @@ from zou.app.blueprints.crud.search_filter_group import (
|
|
|
98
98
|
SearchFilterGroupsResource,
|
|
99
99
|
SearchFilterGroupResource,
|
|
100
100
|
)
|
|
101
|
+
from zou.app.blueprints.crud.hardware_item import (
|
|
102
|
+
HardwareItemsResource,
|
|
103
|
+
HardwareItemResource,
|
|
104
|
+
)
|
|
101
105
|
from zou.app.blueprints.crud.software import (
|
|
102
106
|
SoftwaresResource,
|
|
103
107
|
SoftwareResource,
|
|
@@ -133,8 +137,13 @@ from zou.app.blueprints.crud.salary_scale import (
|
|
|
133
137
|
SalaryScalesResource,
|
|
134
138
|
SalaryScaleResource,
|
|
135
139
|
)
|
|
136
|
-
|
|
137
140
|
from zou.app.blueprints.crud.plugin import PluginResource, PluginsResource
|
|
141
|
+
from zou.app.blueprints.crud.production_schedule_version import (
|
|
142
|
+
ProductionScheduleVersionResource,
|
|
143
|
+
ProductionScheduleVersionsResource,
|
|
144
|
+
ProductionScheduleVersionTaskLinkResource,
|
|
145
|
+
ProductionScheduleVersionTaskLinksResource,
|
|
146
|
+
)
|
|
138
147
|
|
|
139
148
|
routes = [
|
|
140
149
|
("/data/persons", PersonsResource),
|
|
@@ -163,6 +172,8 @@ routes = [
|
|
|
163
172
|
("/data/file-status/<instance_id>", FileStatusResource),
|
|
164
173
|
("/data/softwares", SoftwaresResource),
|
|
165
174
|
("/data/softwares/<instance_id>", SoftwareResource),
|
|
175
|
+
("/data/hardware-items", HardwareItemsResource),
|
|
176
|
+
("/data/hardware-items/<instance_id>", HardwareItemResource),
|
|
166
177
|
("/data/output-files", OutputFilesResource),
|
|
167
178
|
("/data/output-files/<instance_id>", OutputFileResource),
|
|
168
179
|
("/data/output-types", OutputTypesResource),
|
|
@@ -222,6 +233,19 @@ routes = [
|
|
|
222
233
|
("/data/salary-scales/<instance_id>", SalaryScaleResource),
|
|
223
234
|
("/data/plugins/<instance_id>", PluginResource),
|
|
224
235
|
("/data/plugins", PluginsResource),
|
|
236
|
+
("/data/production-schedule-versions", ProductionScheduleVersionsResource),
|
|
237
|
+
(
|
|
238
|
+
"/data/production-schedule-versions/<instance_id>",
|
|
239
|
+
ProductionScheduleVersionResource,
|
|
240
|
+
),
|
|
241
|
+
(
|
|
242
|
+
"/data/production-schedule-version-task-links/<instance_id>",
|
|
243
|
+
ProductionScheduleVersionTaskLinkResource,
|
|
244
|
+
),
|
|
245
|
+
(
|
|
246
|
+
"/data/production-schedule-version-task-links",
|
|
247
|
+
ProductionScheduleVersionTaskLinksResource,
|
|
248
|
+
),
|
|
225
249
|
]
|
|
226
250
|
|
|
227
251
|
blueprint = Blueprint("/data", "data")
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from zou.app.models.hardware_item import HardwareItem
|
|
2
|
+
from zou.app.blueprints.crud.base import BaseModelResource, BaseModelsResource
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class HardwareItemsResource(BaseModelsResource):
|
|
6
|
+
def __init__(self):
|
|
7
|
+
BaseModelsResource.__init__(self, HardwareItem)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class HardwareItemResource(BaseModelResource):
|
|
11
|
+
def __init__(self):
|
|
12
|
+
BaseModelResource.__init__(self, HardwareItem)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from zou.app.models.notification import Notification
|
|
2
|
-
from zou.app.utils import permissions
|
|
3
2
|
|
|
4
3
|
from zou.app.blueprints.crud.base import BaseModelResource, BaseModelsResource
|
|
5
4
|
|
|
@@ -8,9 +7,6 @@ class NotificationsResource(BaseModelsResource):
|
|
|
8
7
|
def __init__(self):
|
|
9
8
|
BaseModelsResource.__init__(self, Notification)
|
|
10
9
|
|
|
11
|
-
def check_create_permissions(self, data):
|
|
12
|
-
return permissions.check_admin_permissions()
|
|
13
|
-
|
|
14
10
|
|
|
15
11
|
class NotificationResource(BaseModelResource):
|
|
16
12
|
def __init__(self):
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
from zou.app.models.production_schedule_version import (
|
|
2
|
+
ProductionScheduleVersion,
|
|
3
|
+
ProductionScheduleVersionTaskLink,
|
|
4
|
+
)
|
|
5
|
+
|
|
6
|
+
from zou.app.blueprints.crud.base import BaseModelsResource, BaseModelResource
|
|
7
|
+
from zou.app.services import user_service, tasks_service, schedule_service
|
|
8
|
+
from zou.app.utils import permissions
|
|
9
|
+
from zou.app.services.exception import WrongParameterException
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ProductionScheduleVersionsResource(BaseModelsResource):
|
|
13
|
+
def __init__(self):
|
|
14
|
+
BaseModelsResource.__init__(self, ProductionScheduleVersion)
|
|
15
|
+
|
|
16
|
+
def check_read_permissions(self, options=None):
|
|
17
|
+
if (
|
|
18
|
+
permissions.has_vendor_permissions()
|
|
19
|
+
or permissions.has_client_permissions()
|
|
20
|
+
):
|
|
21
|
+
raise permissions.PermissionDenied
|
|
22
|
+
if "project_id" in options.keys():
|
|
23
|
+
return user_service.check_project_access(options["project_id"])
|
|
24
|
+
else:
|
|
25
|
+
return permissions.check_admin_permissions()
|
|
26
|
+
|
|
27
|
+
def check_create_permissions(self, data):
|
|
28
|
+
return user_service.check_manager_project_access(
|
|
29
|
+
project_id=data["project_id"]
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ProductionScheduleVersionResource(BaseModelResource):
|
|
34
|
+
def __init__(self):
|
|
35
|
+
BaseModelResource.__init__(self, ProductionScheduleVersion)
|
|
36
|
+
|
|
37
|
+
def check_read_permissions(self, instance_dict):
|
|
38
|
+
if (
|
|
39
|
+
permissions.has_vendor_permissions()
|
|
40
|
+
or permissions.has_client_permissions()
|
|
41
|
+
):
|
|
42
|
+
raise permissions.PermissionDenied
|
|
43
|
+
return user_service.check_project_access(instance_dict["project_id"])
|
|
44
|
+
|
|
45
|
+
def check_update_permissions(self, instance_dict, data):
|
|
46
|
+
return user_service.check_manager_project_access(
|
|
47
|
+
project_id=instance_dict["project_id"]
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class ProductionScheduleVersionTaskLinksResource(BaseModelsResource):
|
|
52
|
+
def __init__(self):
|
|
53
|
+
BaseModelsResource.__init__(self, ProductionScheduleVersionTaskLink)
|
|
54
|
+
|
|
55
|
+
def check_read_permissions(self, options=None):
|
|
56
|
+
if (
|
|
57
|
+
permissions.has_vendor_permissions()
|
|
58
|
+
or permissions.has_client_permissions()
|
|
59
|
+
):
|
|
60
|
+
raise permissions.PermissionDenied
|
|
61
|
+
if "project_id" in options.keys():
|
|
62
|
+
return user_service.check_project_access(options["project_id"])
|
|
63
|
+
else:
|
|
64
|
+
return permissions.check_admin_permissions()
|
|
65
|
+
|
|
66
|
+
def check_create_permissions(self, data):
|
|
67
|
+
project_id_from_production_version_schedule = (
|
|
68
|
+
schedule_service.get_production_schedule_version(
|
|
69
|
+
data["production_schedule_version_id"]
|
|
70
|
+
)["project_id"]
|
|
71
|
+
)
|
|
72
|
+
project_id_from_task = tasks_service.get_task(data["task_id"])[
|
|
73
|
+
"project_id"
|
|
74
|
+
]
|
|
75
|
+
if project_id_from_production_version_schedule != project_id_from_task:
|
|
76
|
+
raise WrongParameterException(
|
|
77
|
+
"The task and the production schedule version must be in the same project."
|
|
78
|
+
)
|
|
79
|
+
return user_service.check_manager_project_access(
|
|
80
|
+
project_id=project_id_from_production_version_schedule
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class ProductionScheduleVersionTaskLinkResource(BaseModelResource):
|
|
85
|
+
def __init__(self):
|
|
86
|
+
BaseModelResource.__init__(self, ProductionScheduleVersionTaskLink)
|
|
87
|
+
self.protected_fields = [
|
|
88
|
+
"id",
|
|
89
|
+
"created_at",
|
|
90
|
+
"updated_at",
|
|
91
|
+
"task_id",
|
|
92
|
+
"production_schedule_version_id",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
def check_read_permissions(self, instance_dict):
|
|
96
|
+
if (
|
|
97
|
+
permissions.has_vendor_permissions()
|
|
98
|
+
or permissions.has_client_permissions()
|
|
99
|
+
):
|
|
100
|
+
raise permissions.PermissionDenied
|
|
101
|
+
task = tasks_service.get_task(instance_dict["task_id"])
|
|
102
|
+
return user_service.check_project_access(task["project_id"])
|
|
103
|
+
|
|
104
|
+
def check_update_permissions(self, instance_dict, data):
|
|
105
|
+
task = tasks_service.get_task(instance_dict["task_id"])
|
|
106
|
+
return user_service.check_manager_project_access(
|
|
107
|
+
project_id=task["project_id"]
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
def check_delete_permissions(self, instance_dict):
|
|
111
|
+
task = tasks_service.get_task(instance_dict["task_id"])
|
|
112
|
+
return user_service.check_manager_project_access(
|
|
113
|
+
project_id=task["project_id"]
|
|
114
|
+
)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from flask import Blueprint
|
|
2
|
+
from zou.app.utils.api import configure_api_from_blueprint
|
|
3
|
+
|
|
4
|
+
from zou.app.blueprints.departments.resources import (
|
|
5
|
+
AllDepartmentSoftwareResource,
|
|
6
|
+
AddSoftwareToDepartmentResource,
|
|
7
|
+
SoftwareDepartmentResource,
|
|
8
|
+
AllDepartmentHardwareItemsResource,
|
|
9
|
+
AddHardwareItemToDepartmentResource,
|
|
10
|
+
HardwareItemDepartmentResource,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
routes = [
|
|
14
|
+
("/data/departments/software-licenses", AllDepartmentSoftwareResource),
|
|
15
|
+
(
|
|
16
|
+
"/data/departments/<department_id>/software-licenses",
|
|
17
|
+
AddSoftwareToDepartmentResource,
|
|
18
|
+
),
|
|
19
|
+
(
|
|
20
|
+
"/data/departments/<department_id>/software-licenses/<software_id>",
|
|
21
|
+
SoftwareDepartmentResource,
|
|
22
|
+
),
|
|
23
|
+
("/data/departments/hardware-items", AllDepartmentHardwareItemsResource),
|
|
24
|
+
(
|
|
25
|
+
"/data/departments/<department_id>/hardware-items",
|
|
26
|
+
AddHardwareItemToDepartmentResource,
|
|
27
|
+
),
|
|
28
|
+
(
|
|
29
|
+
"/data/departments/<department_id>/hardware-items/<hardware_item_id>",
|
|
30
|
+
HardwareItemDepartmentResource,
|
|
31
|
+
),
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
blueprint = Blueprint("departments", "departments")
|
|
35
|
+
api = configure_api_from_blueprint(blueprint, routes)
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
from flask_restful import Resource
|
|
2
|
+
from flask_jwt_extended import jwt_required
|
|
3
|
+
|
|
4
|
+
from zou.app.utils import permissions
|
|
5
|
+
from zou.app.mixin import ArgsMixin
|
|
6
|
+
from zou.app.services import (
|
|
7
|
+
departments_service,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AllDepartmentSoftwareResource(Resource, ArgsMixin):
|
|
12
|
+
|
|
13
|
+
@jwt_required()
|
|
14
|
+
@permissions.require_admin
|
|
15
|
+
def get(self):
|
|
16
|
+
"""
|
|
17
|
+
Get all software items for all departments.
|
|
18
|
+
---
|
|
19
|
+
tags:
|
|
20
|
+
- Departments
|
|
21
|
+
responses:
|
|
22
|
+
200:
|
|
23
|
+
description: A dictionary of departments with their software items
|
|
24
|
+
"""
|
|
25
|
+
softwares = departments_service.get_all_software_for_departments()
|
|
26
|
+
return softwares, 200
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class AddSoftwareToDepartmentResource(Resource, ArgsMixin):
|
|
30
|
+
|
|
31
|
+
@jwt_required()
|
|
32
|
+
@permissions.require_admin
|
|
33
|
+
def post(self, department_id):
|
|
34
|
+
"""
|
|
35
|
+
Add a software item to given department.
|
|
36
|
+
---
|
|
37
|
+
tags:
|
|
38
|
+
- Departments
|
|
39
|
+
parameters:
|
|
40
|
+
- in: path
|
|
41
|
+
name: department_id
|
|
42
|
+
required: True
|
|
43
|
+
type: string
|
|
44
|
+
format: UUID
|
|
45
|
+
x-example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
46
|
+
- in: body
|
|
47
|
+
name: software_id
|
|
48
|
+
required: True
|
|
49
|
+
type: string
|
|
50
|
+
format: UUID
|
|
51
|
+
x-example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
52
|
+
responses:
|
|
53
|
+
201:
|
|
54
|
+
description: User added to given department
|
|
55
|
+
404:
|
|
56
|
+
description: Department ID or Software ID matches no department or software
|
|
57
|
+
"""
|
|
58
|
+
args = self.get_args(
|
|
59
|
+
[
|
|
60
|
+
("software_id", None, True),
|
|
61
|
+
]
|
|
62
|
+
)
|
|
63
|
+
self.check_id_parameter(department_id)
|
|
64
|
+
self.check_id_parameter(args["software_id"])
|
|
65
|
+
software = departments_service.add_software_to_department(
|
|
66
|
+
department_id, args["software_id"]
|
|
67
|
+
)
|
|
68
|
+
return software, 201
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class SoftwareDepartmentResource(Resource, ArgsMixin):
|
|
72
|
+
|
|
73
|
+
@jwt_required()
|
|
74
|
+
@permissions.require_admin
|
|
75
|
+
def get(self, department_id):
|
|
76
|
+
"""
|
|
77
|
+
Get all software items for a given department.
|
|
78
|
+
---
|
|
79
|
+
tags:
|
|
80
|
+
- Departments
|
|
81
|
+
parameters:
|
|
82
|
+
- in: path
|
|
83
|
+
name: department_id
|
|
84
|
+
required: True
|
|
85
|
+
type: string
|
|
86
|
+
format: UUID
|
|
87
|
+
x-example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
88
|
+
responses:
|
|
89
|
+
200:
|
|
90
|
+
description: Software items for given department
|
|
91
|
+
404:
|
|
92
|
+
description: Department ID matches no department
|
|
93
|
+
"""
|
|
94
|
+
self.check_id_parameter(department_id)
|
|
95
|
+
softwares = departments_service.get_softwares_for_department(
|
|
96
|
+
department_id
|
|
97
|
+
)
|
|
98
|
+
return softwares, 200
|
|
99
|
+
|
|
100
|
+
@jwt_required()
|
|
101
|
+
@permissions.require_admin
|
|
102
|
+
def delete(self, department_id, software_id):
|
|
103
|
+
"""
|
|
104
|
+
Remove a software item from given department.
|
|
105
|
+
---
|
|
106
|
+
tags:
|
|
107
|
+
- Departments
|
|
108
|
+
parameters:
|
|
109
|
+
- in: path
|
|
110
|
+
name: software_id
|
|
111
|
+
required: True
|
|
112
|
+
type: string
|
|
113
|
+
format: UUID
|
|
114
|
+
x-example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
115
|
+
- in: path
|
|
116
|
+
name: department_id
|
|
117
|
+
required: True
|
|
118
|
+
type: string
|
|
119
|
+
format: UUID
|
|
120
|
+
x-example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
121
|
+
responses:
|
|
122
|
+
204:
|
|
123
|
+
description: User removed from given department
|
|
124
|
+
404:
|
|
125
|
+
description: Department or software ID matches no department or software
|
|
126
|
+
"""
|
|
127
|
+
self.check_id_parameter(department_id)
|
|
128
|
+
self.check_id_parameter(software_id)
|
|
129
|
+
departments_service.remove_software_from_department(
|
|
130
|
+
department_id, software_id
|
|
131
|
+
)
|
|
132
|
+
return "", 204
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class AllDepartmentHardwareItemsResource(Resource, ArgsMixin):
|
|
136
|
+
|
|
137
|
+
@jwt_required()
|
|
138
|
+
@permissions.require_admin
|
|
139
|
+
def get(self):
|
|
140
|
+
"""
|
|
141
|
+
Get all hardware items for all departments.
|
|
142
|
+
---
|
|
143
|
+
tags:
|
|
144
|
+
- Departments
|
|
145
|
+
responses:
|
|
146
|
+
200:
|
|
147
|
+
description: A dictionary of departments with their hardware items
|
|
148
|
+
"""
|
|
149
|
+
hardware_items = (
|
|
150
|
+
departments_service.get_all_hardware_items_for_departments()
|
|
151
|
+
)
|
|
152
|
+
return hardware_items, 200
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class AddHardwareItemToDepartmentResource(Resource, ArgsMixin):
|
|
156
|
+
|
|
157
|
+
@jwt_required()
|
|
158
|
+
@permissions.require_admin
|
|
159
|
+
def post(self, department_id):
|
|
160
|
+
"""
|
|
161
|
+
Add a hardware item to given department.
|
|
162
|
+
---
|
|
163
|
+
tags:
|
|
164
|
+
- Departments
|
|
165
|
+
parameters:
|
|
166
|
+
- in: path
|
|
167
|
+
name: department_id
|
|
168
|
+
required: True
|
|
169
|
+
type: string
|
|
170
|
+
format: UUID
|
|
171
|
+
x-example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
172
|
+
- in: body
|
|
173
|
+
name: hardware_item_id
|
|
174
|
+
required: True
|
|
175
|
+
type: string
|
|
176
|
+
format: UUID
|
|
177
|
+
x-example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
178
|
+
responses:
|
|
179
|
+
201:
|
|
180
|
+
description: Hardware item added to given department
|
|
181
|
+
404:
|
|
182
|
+
description: Department ID matches no department
|
|
183
|
+
400:
|
|
184
|
+
description: Hardware item ID matches no hardware item
|
|
185
|
+
"""
|
|
186
|
+
args = self.get_args(
|
|
187
|
+
[
|
|
188
|
+
("hardware_item_id", None, True),
|
|
189
|
+
]
|
|
190
|
+
)
|
|
191
|
+
self.check_id_parameter(department_id)
|
|
192
|
+
self.check_id_parameter(args["hardware_item_id"])
|
|
193
|
+
hardware_item_link = (
|
|
194
|
+
departments_service.add_hardware_item_to_department(
|
|
195
|
+
department_id, args["hardware_item_id"]
|
|
196
|
+
)
|
|
197
|
+
)
|
|
198
|
+
return hardware_item_link, 201
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class HardwareItemDepartmentResource(Resource, ArgsMixin):
|
|
202
|
+
|
|
203
|
+
@jwt_required()
|
|
204
|
+
@permissions.require_admin
|
|
205
|
+
def get(self, department_id):
|
|
206
|
+
"""
|
|
207
|
+
Get all hardware items for a given department.
|
|
208
|
+
---
|
|
209
|
+
tags:
|
|
210
|
+
- Departments
|
|
211
|
+
parameters:
|
|
212
|
+
- in: path
|
|
213
|
+
name: department_id
|
|
214
|
+
required: True
|
|
215
|
+
type: string
|
|
216
|
+
format: UUID
|
|
217
|
+
x-example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
218
|
+
responses:
|
|
219
|
+
200:
|
|
220
|
+
description: Hardware items for given department
|
|
221
|
+
404:
|
|
222
|
+
description: Department ID matches no department
|
|
223
|
+
"""
|
|
224
|
+
self.check_id_parameter(department_id)
|
|
225
|
+
hardware_items = departments_service.get_hardware_items_for_department(
|
|
226
|
+
department_id
|
|
227
|
+
)
|
|
228
|
+
return hardware_items, 200
|
|
229
|
+
|
|
230
|
+
@jwt_required()
|
|
231
|
+
@permissions.require_admin
|
|
232
|
+
def delete(self, department_id, hardware_item_id):
|
|
233
|
+
"""
|
|
234
|
+
Remove a hardware item from given department.
|
|
235
|
+
---
|
|
236
|
+
tags:
|
|
237
|
+
- Departments
|
|
238
|
+
parameters:
|
|
239
|
+
- in: path
|
|
240
|
+
name: department_id
|
|
241
|
+
required: True
|
|
242
|
+
type: string
|
|
243
|
+
format: UUID
|
|
244
|
+
x-example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
245
|
+
- in: path
|
|
246
|
+
name: hardware_item_id
|
|
247
|
+
required: True
|
|
248
|
+
type: string
|
|
249
|
+
format: UUID
|
|
250
|
+
x-example: a24a6ea4-ce75-4665-a070-57453082c25
|
|
251
|
+
responses:
|
|
252
|
+
204:
|
|
253
|
+
description: User removed from given department
|
|
254
|
+
404:
|
|
255
|
+
description: Department or software ID matches no department or software
|
|
256
|
+
"""
|
|
257
|
+
self.check_id_parameter(department_id)
|
|
258
|
+
self.check_id_parameter(hardware_item_id)
|
|
259
|
+
departments_service.remove_hardware_item_from_department(
|
|
260
|
+
department_id, hardware_item_id
|
|
261
|
+
)
|
|
262
|
+
return "", 204
|
|
@@ -52,10 +52,7 @@ class BaseStatusResource(Resource):
|
|
|
52
52
|
is_es_up = True
|
|
53
53
|
try:
|
|
54
54
|
requests.get(
|
|
55
|
-
"http://{
|
|
56
|
-
host=config.EVENT_STREAM_HOST,
|
|
57
|
-
port=config.EVENT_STREAM_PORT,
|
|
58
|
-
)
|
|
55
|
+
f"http://{config.EVENT_STREAM_HOST}:{config.EVENT_STREAM_PORT}"
|
|
59
56
|
)
|
|
60
57
|
except Exception:
|
|
61
58
|
is_es_up = False
|
|
@@ -77,11 +74,7 @@ class BaseStatusResource(Resource):
|
|
|
77
74
|
is_indexer_up = True
|
|
78
75
|
try:
|
|
79
76
|
requests.get(
|
|
80
|
-
"{protocol}://{host}:{port}"
|
|
81
|
-
protocol=config.INDEXER["protocol"],
|
|
82
|
-
host=config.INDEXER["host"],
|
|
83
|
-
port=config.INDEXER["port"],
|
|
84
|
-
)
|
|
77
|
+
f"{config.INDEXER['protocol']}://{config.INDEXER['host']}:{config.INDEXER['port']}"
|
|
85
78
|
)
|
|
86
79
|
except Exception:
|
|
87
80
|
is_indexer_up = False
|
|
@@ -172,9 +172,7 @@ class TimeSpentsResource(Resource, ArgsMixin):
|
|
|
172
172
|
except WrongDateFormatException:
|
|
173
173
|
abort(
|
|
174
174
|
400,
|
|
175
|
-
"Wrong date format for {} and/or {}"
|
|
176
|
-
start_date, end_date
|
|
177
|
-
),
|
|
175
|
+
f"Wrong date format for {start_date} and/or {end_date}",
|
|
178
176
|
)
|
|
179
177
|
|
|
180
178
|
|
|
@@ -31,6 +31,10 @@ from zou.app.blueprints.projects.resources import (
|
|
|
31
31
|
ProductionBudgetEntriesResource,
|
|
32
32
|
ProductionBudgetEntryResource,
|
|
33
33
|
ProductionMonthTimeSpentsResource,
|
|
34
|
+
ProductionScheduleVersionTaskLinksResource,
|
|
35
|
+
ProductionScheduleVersionSetTaskLinksFromTasksResource,
|
|
36
|
+
ProductionScheduleVersionSetTaskLinksFromProductionScheduleVersionResource,
|
|
37
|
+
ProductionScheduleVersionApplyToProductionResource,
|
|
34
38
|
)
|
|
35
39
|
|
|
36
40
|
routes = [
|
|
@@ -132,6 +136,22 @@ routes = [
|
|
|
132
136
|
"/data/projects/<project_id>/budgets/time-spents",
|
|
133
137
|
ProductionMonthTimeSpentsResource,
|
|
134
138
|
),
|
|
139
|
+
(
|
|
140
|
+
"/data/production-schedule-versions/<production_schedule_version_id>/task-links",
|
|
141
|
+
ProductionScheduleVersionTaskLinksResource,
|
|
142
|
+
),
|
|
143
|
+
(
|
|
144
|
+
"/actions/production-schedule-versions/<production_schedule_version_id>/set-task-links-from-production",
|
|
145
|
+
ProductionScheduleVersionSetTaskLinksFromTasksResource,
|
|
146
|
+
),
|
|
147
|
+
(
|
|
148
|
+
"/actions/production-schedule-versions/<production_schedule_version_id>/set-task-links-from-production-schedule-version",
|
|
149
|
+
ProductionScheduleVersionSetTaskLinksFromProductionScheduleVersionResource,
|
|
150
|
+
),
|
|
151
|
+
(
|
|
152
|
+
"/actions/production-schedule-versions/<production_schedule_version_id>/apply-to-production",
|
|
153
|
+
ProductionScheduleVersionApplyToProductionResource,
|
|
154
|
+
),
|
|
135
155
|
]
|
|
136
156
|
|
|
137
157
|
blueprint = Blueprint("projects", "projects")
|