about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gn3/case_attributes.py9
-rw-r--r--gn3/db/case_attributes.py18
2 files changed, 19 insertions, 8 deletions
diff --git a/gn3/case_attributes.py b/gn3/case_attributes.py
index 91d8b7f..8312f0d 100644
--- a/gn3/case_attributes.py
+++ b/gn3/case_attributes.py
@@ -6,7 +6,6 @@ import uuid
 import tempfile
 import lmdb
 import pickle
-from dataclasses import dataclass
 from typing import Union
 from enum import Enum, auto
 from pathlib import Path
@@ -16,6 +15,7 @@ from urllib.parse import urljoin
 
 import requests
 from MySQLdb.cursors import DictCursor
+from gn3.db.case_attributes import CaseAttributeEdit
 from authlib.integrations.flask_oauth2.errors import _HTTPException
 from flask import (
     jsonify,
@@ -37,13 +37,6 @@ caseattr = Blueprint("case-attribute", __name__)
 CATTR_DIFFS_DIR = "case-attribute-diffs"
 
 
-@dataclass
-class CaseAttributeEdit:
-    inbredset_id: int
-    user_id: str
-    diff: dict
-
-
 class NoDiffError(ValueError):
     """Raised if there is no difference between the old and new data."""
     def __init__(self):
diff --git a/gn3/db/case_attributes.py b/gn3/db/case_attributes.py
index bb15248..7b56bc4 100644
--- a/gn3/db/case_attributes.py
+++ b/gn3/db/case_attributes.py
@@ -1,10 +1,28 @@
 """Module that contains functions for editing case-attribute data"""
 from typing import Any, Optional, Tuple
+from dataclasses import dataclass
 
 import json
 import MySQLdb
 
 
+@dataclass
+class CaseAttributeEdit:
+    """Represents an edit operation for case attributes in the database.
+
+    Attributes:
+        inbredset_id (int): The ID of the inbred set associated with
+        the edit.
+        user_id (str): The ID of the user performing the edit.
+        changes (dict): A dictionary containing the changes to be
+    applied to the case attributes.
+
+    """
+    inbredset_id: int
+    user_id: str
+    changes: dict
+
+
 def get_case_attributes(conn) -> Optional[Tuple]:
     """Get all the case attributes from the database."""
     with conn.cursor() as cursor: