Source code for ace.centralize.models.note

"""
    Note models for Centralize

    Models for notes attached to entities.

    Based on the Note/Task GraphQL schema (NoteCreateParamsInput,
    NoteEntityCreateParamsInput, NoteUpdateParamsInput, etc.)
"""
from typing import List, Optional

from ace.centralize.models.base import ModelBase


[docs] class NoteCreateParamsInput(ModelBase): """Maps to NoteCreateParamsInput in GraphQL schema (standalone create)."""
[docs] def __init__( self, description: str, entity_id: int, entity_type_id: str, note_type_id: int, priority_id: int, ): self.description = description self.entityId = entity_id self.entityTypeId = entity_type_id self.noteTypeId = note_type_id self.priorityId = priority_id
# Backward-compatible alias CreateNoteObject = NoteCreateParamsInput
[docs] class NoteEntityCreateParamsInput(ModelBase): """Maps to NoteEntityCreateParamsInput in GraphQL schema (nested in entity mutation)."""
[docs] def __init__( self, description: str, note_type_id: Optional[int] = None, priority_id: Optional[int] = None, ): self.description = description if note_type_id is not None: self.noteTypeId = note_type_id if priority_id is not None: self.priorityId = priority_id
# Backward-compatible alias CreateEntityNoteObject = NoteEntityCreateParamsInput
[docs] class NoteEntityUpdateParamsInput(ModelBase): """Maps to NoteEntityUpdateParamsInput in GraphQL schema (nested in entity mutation)."""
[docs] def __init__( self, id: int, description: Optional[str] = None, note_type_id: Optional[int] = None, priority_id: Optional[int] = None, ): self.id = id if description is not None: self.description = description if note_type_id is not None: self.noteTypeId = note_type_id if priority_id is not None: self.priorityId = priority_id
# Backward-compatible alias UpdateEntityNoteObject = NoteEntityUpdateParamsInput
[docs] class NoteListEntityUpdateParamsInput(ModelBase): """Maps to NoteListEntityUpdateParamsInput in GraphQL schema (for updateNotes on policy)."""
[docs] def __init__( self, to_add: Optional[List[NoteEntityCreateParamsInput]] = None, to_delete: Optional[List[int]] = None, to_update: Optional[List[NoteEntityUpdateParamsInput]] = None, ): if to_add is not None: self.toAdd = to_add if to_delete is not None: self.toDelete = to_delete if to_update is not None: self.toUpdate = to_update
[docs] class NoteUpdateParamsInput(ModelBase): """Maps to NoteUpdateParamsInput in GraphQL schema (standalone update)."""
[docs] def __init__( self, note_id: int, params: NoteCreateParamsInput, ): self.noteId = note_id self.params = params