diff --git a/gn_auth/auth/authorisation/resources/models.py b/gn_auth/auth/authorisation/resources/models.py
index b8eaacb..c3d0f7e 100644
--- a/gn_auth/auth/authorisation/resources/models.py
+++ b/gn_auth/auth/authorisation/resources/models.py
@@ -1,4 +1,5 @@
"""Handle the management of resources."""
+from datetime import datetime
from dataclasses import asdict
from uuid import UUID, uuid4
from functools import reduce, partial
@@ -46,17 +47,20 @@ def create_resource(# pylint: disable=[too-many-arguments, too-many-positional-a
resource_category: ResourceCategory,
user: User,
group: Group,
- public: bool
+ public: bool,
+ created_at: datetime = datetime.now()
) -> Resource:
"""Create a resource item."""
def __create_resource__(cursor: db.DbCursor) -> Resource:
resource = Resource(uuid4(), resource_name, resource_category, public)
cursor.execute(
- "INSERT INTO resources VALUES (?, ?, ?, ?)",
+ "INSERT INTO resources VALUES (?, ?, ?, ?, ?, ?)",
(str(resource.resource_id),
resource_name,
str(resource.resource_category.resource_category_id),
- 1 if resource.public else 0))
+ 1 if resource.public else 0,
+ str(user.user_id),
+ created_at.timestamp()))
# TODO: @fredmanglis,@rookie101
# 1. Move the actions below into a (the?) hooks system
# 2. Do more checks: A resource can have varying hooks depending on type
|