latest
This commit is contained in:
@@ -13,8 +13,8 @@ def get_static_nodes(context: str, db_name: str) -> List[Dict[str, Any]]:
|
||||
query = """
|
||||
MATCH (t:Teacher)
|
||||
RETURN DISTINCT {
|
||||
id: t.unique_id,
|
||||
path: t.path,
|
||||
id: t.uuid_string,
|
||||
path: t.node_storage_path,
|
||||
label: t.teacher_name_formal,
|
||||
type: 'Teacher',
|
||||
isStatic: true,
|
||||
@@ -24,8 +24,8 @@ def get_static_nodes(context: str, db_name: str) -> List[Dict[str, Any]]:
|
||||
UNION ALL
|
||||
MATCH (t:UserTeacherTimetable)
|
||||
RETURN DISTINCT {
|
||||
id: t.unique_id,
|
||||
path: t.path,
|
||||
id: t.uuid_string,
|
||||
path: t.node_storage_path,
|
||||
label: t.name,
|
||||
type: 'UserTeacherTimetable',
|
||||
isStatic: true,
|
||||
@@ -35,8 +35,8 @@ def get_static_nodes(context: str, db_name: str) -> List[Dict[str, Any]]:
|
||||
UNION ALL
|
||||
MATCH (t:UserTeacherTimetable)-[:HAS_CLASS]->(c:Class)
|
||||
RETURN DISTINCT {
|
||||
id: c.unique_id,
|
||||
path: c.path,
|
||||
id: c.uuid_string,
|
||||
path: c.node_storage_path,
|
||||
label: c.name,
|
||||
type: 'Class',
|
||||
isStatic: true,
|
||||
@@ -49,8 +49,8 @@ def get_static_nodes(context: str, db_name: str) -> List[Dict[str, Any]]:
|
||||
query = """
|
||||
MATCH (u:User)
|
||||
RETURN DISTINCT {
|
||||
id: u.unique_id,
|
||||
path: u.path,
|
||||
id: u.uuid_string,
|
||||
path: u.node_storage_path,
|
||||
label: u.user_name,
|
||||
type: 'User',
|
||||
isStatic: true,
|
||||
@@ -70,8 +70,8 @@ def get_static_nodes(context: str, db_name: str) -> List[Dict[str, Any]]:
|
||||
ELSE 1
|
||||
END as nodeOrder
|
||||
RETURN DISTINCT {
|
||||
id: n.unique_id,
|
||||
path: n.path,
|
||||
id: n.uuid_string,
|
||||
path: n.node_storage_path,
|
||||
label: n.name,
|
||||
type: 'Calendar',
|
||||
isStatic: true,
|
||||
@@ -98,7 +98,7 @@ def get_today_calendar_node(db_name: str) -> Optional[Dict[str, Any]]:
|
||||
query = """
|
||||
MATCH (n:Calendar)
|
||||
WHERE date($today) >= date(n.start_date) AND date($today) <= date(n.end_date)
|
||||
RETURN n.unique_id as id, n.path as path, n.name as label,
|
||||
RETURN n.uuid_string as id, n.path as path, n.name as label,
|
||||
'Calendar' as type
|
||||
LIMIT 1
|
||||
"""
|
||||
@@ -117,7 +117,7 @@ def get_relative_calendar_node(day_offset: int, db_name: str) -> Optional[Dict[s
|
||||
query = """
|
||||
MATCH (n:Calendar)
|
||||
WHERE date($target_date) >= date(n.start_date) AND date($target_date) <= date(n.end_date)
|
||||
RETURN n.unique_id as id, n.path as path, n.name as label,
|
||||
RETURN n.uuid_string as id, n.node_storage_path as path, n.name as label,
|
||||
'Calendar' as type
|
||||
LIMIT 1
|
||||
"""
|
||||
@@ -136,7 +136,7 @@ def get_next_month_node(db_name: str) -> Optional[Dict[str, Any]]:
|
||||
query = """
|
||||
MATCH (n:Calendar)
|
||||
WHERE date($next_month_start) >= date(n.start_date) AND date($next_month_start) <= date(n.end_date)
|
||||
RETURN n.unique_id as id, n.path as path, n.name as label,
|
||||
RETURN n.uuid_string as id, n.node_storage_path as path, n.name as label,
|
||||
'Calendar' as type
|
||||
LIMIT 1
|
||||
"""
|
||||
@@ -155,7 +155,7 @@ def get_previous_month_node(db_name: str) -> Optional[Dict[str, Any]]:
|
||||
query = """
|
||||
MATCH (n:Calendar)
|
||||
WHERE date($prev_month_start) >= date(n.start_date) AND date($prev_month_start) <= date(n.end_date)
|
||||
RETURN n.unique_id as id, n.path as path, n.name as label,
|
||||
RETURN n.uuid_string as id, n.node_storage_path as path, n.name as label,
|
||||
'Calendar' as type
|
||||
LIMIT 1
|
||||
"""
|
||||
@@ -172,7 +172,7 @@ def get_user_timetables(db_name: str) -> List[Dict[str, Any]]:
|
||||
"""Get user's timetables."""
|
||||
query = """
|
||||
MATCH (t:UserTeacherTimetable)
|
||||
RETURN t.unique_id as id, t.path as path, t.name as label,
|
||||
RETURN t.uuid_string as id, t.node_storage_path as path, t.name as label,
|
||||
'UserTeacherTimetable' as type
|
||||
"""
|
||||
try:
|
||||
@@ -186,8 +186,8 @@ def get_user_timetables(db_name: str) -> List[Dict[str, Any]]:
|
||||
def get_timetable_classes(timetable_id: str, db_name: str) -> List[Dict[str, Any]]:
|
||||
"""Get classes for a timetable."""
|
||||
query = """
|
||||
MATCH (t:UserTeacherTimetable {unique_id: $timetable_id})-[:HAS_CLASS]->(c:Class)
|
||||
RETURN c.unique_id as id, c.path as path, c.name as label,
|
||||
MATCH (t:UserTeacherTimetable {uuid_string: $timetable_id})-[:HAS_CLASS]->(c:Class)
|
||||
RETURN c.uuid_string as id, c.node_storage_path as path, c.name as label,
|
||||
'Class' as type
|
||||
"""
|
||||
try:
|
||||
@@ -202,9 +202,9 @@ def get_next_lesson(class_id: str, db_name: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get next lesson for a class."""
|
||||
now = datetime.now().strftime("%Y-%m-%d %H:%M")
|
||||
query = """
|
||||
MATCH (c:Class {unique_id: $class_id})-[:HAS_LESSON]->(l:Lesson)
|
||||
MATCH (c:Class {uuid_string: $class_id})-[:HAS_LESSON]->(l:Lesson)
|
||||
WHERE l.start_time > $now
|
||||
RETURN l.unique_id as id, l.path as path, l.name as label,
|
||||
RETURN l.uuid_string as id, l.node_storage_path as path, l.name as label,
|
||||
'Lesson' as type
|
||||
ORDER BY l.start_time ASC
|
||||
LIMIT 1
|
||||
@@ -222,9 +222,9 @@ def get_previous_lesson(class_id: str, db_name: str) -> Optional[Dict[str, Any]]
|
||||
"""Get previous lesson for a class."""
|
||||
now = datetime.now().strftime("%Y-%m-%d %H:%M")
|
||||
query = """
|
||||
MATCH (c:Class {unique_id: $class_id})-[:HAS_LESSON]->(l:Lesson)
|
||||
MATCH (c:Class {uuid_string: $class_id})-[:HAS_LESSON]->(l:Lesson)
|
||||
WHERE l.start_time < $now
|
||||
RETURN l.unique_id as id, l.path as path, l.name as label,
|
||||
RETURN l.uuid_string as id, l.path as path, l.name as label,
|
||||
'Lesson' as type
|
||||
ORDER BY l.start_time DESC
|
||||
LIMIT 1
|
||||
@@ -251,20 +251,20 @@ def save_shared_snapshot(path: str, room_id: str, snapshot: Dict[str, Any]) -> b
|
||||
def get_connected_nodes_for_workers(node_id: str, db_name: str) -> List[Dict[str, Any]]:
|
||||
"""Get connected nodes specific to the workers context."""
|
||||
query = """
|
||||
MATCH (n {unique_id: $node_id})
|
||||
MATCH (n {uuid_string: $node_id})
|
||||
WITH n
|
||||
CALL {
|
||||
WITH n
|
||||
MATCH (n:UserTeacherTimetable)-[:HAS_CLASS]->(c:Class)
|
||||
RETURN c.unique_id as id, c.path as path, c.name as label,
|
||||
RETURN c.uuid_string as id, c.node_storage_path as path, c.name as label,
|
||||
'Class' as type
|
||||
UNION
|
||||
MATCH (n:Class)<-[:HAS_CLASS]-(t:UserTeacherTimetable)
|
||||
RETURN t.unique_id as id, t.path as path, t.name as label,
|
||||
RETURN t.uuid_string as id, t.node_storage_path as path, t.name as label,
|
||||
'UserTeacherTimetable' as type
|
||||
UNION
|
||||
MATCH (n:Class)-[:HAS_LESSON]->(l:Lesson)
|
||||
RETURN l.unique_id as id, l.path as path, l.name as label,
|
||||
RETURN l.uuid_string as id, l.node_storage_path as path, l.name as label,
|
||||
'Lesson' as type
|
||||
}
|
||||
RETURN DISTINCT id, path, label, type
|
||||
@@ -284,8 +284,8 @@ def get_connected_nodes(node_id: str, db_name: str, context: str = None) -> List
|
||||
|
||||
# Default query for other contexts
|
||||
query = """
|
||||
MATCH (n {unique_id: $node_id})-[r]-(connected)
|
||||
RETURN DISTINCT connected.unique_id as id, connected.path as path,
|
||||
MATCH (n {uuid_string: $node_id})-[r]-(connected)
|
||||
RETURN DISTINCT connected.uuid_string as id, connected.path as path,
|
||||
connected.name as label, labels(connected)[0] as type
|
||||
"""
|
||||
try:
|
||||
@@ -314,37 +314,37 @@ def get_worker_structure(db_name: str) -> Dict[str, Any]:
|
||||
// Collect all nodes
|
||||
RETURN {
|
||||
schools: collect(DISTINCT {
|
||||
id: s.unique_id,
|
||||
path: s.path,
|
||||
id: s.uuid_string,
|
||||
path: s.node_storage_path,
|
||||
name: s.school_name,
|
||||
__primarylabel__: 'School'
|
||||
}),
|
||||
departments: collect(DISTINCT {
|
||||
id: d.unique_id,
|
||||
path: d.path,
|
||||
id: d.uuid_string,
|
||||
path: d.node_storage_path,
|
||||
code: d.department_code,
|
||||
school_id: s.unique_id,
|
||||
school_id: s.uuid_string,
|
||||
__primarylabel__: 'Department'
|
||||
}),
|
||||
timetables: collect(DISTINCT {
|
||||
id: t.unique_id,
|
||||
path: t.path,
|
||||
id: t.uuid_string,
|
||||
path: t.node_storage_path,
|
||||
name: t.name,
|
||||
department_id: d.unique_id,
|
||||
department_id: d.uuid_string,
|
||||
__primarylabel__: 'UserTeacherTimetable'
|
||||
}),
|
||||
classes: collect(DISTINCT {
|
||||
id: c.unique_id,
|
||||
path: c.path,
|
||||
id: c.uuid_string,
|
||||
path: c.node_storage_path,
|
||||
code: c.class_code,
|
||||
timetable_id: t.unique_id,
|
||||
timetable_id: t.uuid_string,
|
||||
__primarylabel__: 'Class'
|
||||
}),
|
||||
lessons: collect(DISTINCT {
|
||||
id: l.unique_id,
|
||||
path: l.path,
|
||||
id: l.uuid_string,
|
||||
path: l.node_storage_path,
|
||||
start_time: l.start_time,
|
||||
class_id: c.unique_id,
|
||||
class_id: c.uuid_string,
|
||||
__primarylabel__: 'TimetableLesson'
|
||||
})
|
||||
} as structure
|
||||
@@ -369,10 +369,10 @@ def get_worker_structure(db_name: str) -> Dict[str, Any]:
|
||||
def get_school_node(school_id: str, db_name: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get a specific school node."""
|
||||
query = """
|
||||
MATCH (s:School {unique_id: $school_id})
|
||||
MATCH (s:School {uuid_string: $school_id})
|
||||
RETURN {
|
||||
id: s.unique_id,
|
||||
path: s.path,
|
||||
id: s.uuid_string,
|
||||
path: s.node_storage_path,
|
||||
name: s.school_name,
|
||||
__primarylabel__: 'School'
|
||||
} as node
|
||||
@@ -389,10 +389,10 @@ def get_school_node(school_id: str, db_name: str) -> Optional[Dict[str, Any]]:
|
||||
def get_department_node(dept_id: str, db_name: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get a specific department node."""
|
||||
query = """
|
||||
MATCH (d:Department {unique_id: $dept_id})
|
||||
MATCH (d:Department {uuid_string: $dept_id})
|
||||
RETURN {
|
||||
id: d.unique_id,
|
||||
path: d.path,
|
||||
id: d.uuid_string,
|
||||
path: d.node_storage_path,
|
||||
code: d.department_code,
|
||||
__primarylabel__: 'Department'
|
||||
} as node
|
||||
@@ -409,10 +409,10 @@ def get_department_node(dept_id: str, db_name: str) -> Optional[Dict[str, Any]]:
|
||||
def get_timetable_node(timetable_id: str, db_name: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get a specific timetable node."""
|
||||
query = """
|
||||
MATCH (t:UserTeacherTimetable {unique_id: $timetable_id})
|
||||
MATCH (t:UserTeacherTimetable {uuid_string: $timetable_id})
|
||||
RETURN {
|
||||
id: t.unique_id,
|
||||
path: t.path,
|
||||
id: t.uuid_string,
|
||||
path: t.node_storage_path,
|
||||
name: t.name,
|
||||
__primarylabel__: 'UserTeacherTimetable'
|
||||
} as node
|
||||
@@ -429,10 +429,10 @@ def get_timetable_node(timetable_id: str, db_name: str) -> Optional[Dict[str, An
|
||||
def get_class_node(class_id: str, db_name: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get a specific class node."""
|
||||
query = """
|
||||
MATCH (c:Class {unique_id: $class_id})
|
||||
MATCH (c:Class {uuid_string: $class_id})
|
||||
RETURN {
|
||||
id: c.unique_id,
|
||||
path: c.path,
|
||||
id: c.uuid_string,
|
||||
path: c.node_storage_path,
|
||||
code: c.class_code,
|
||||
__primarylabel__: 'Class'
|
||||
} as node
|
||||
@@ -449,10 +449,10 @@ def get_class_node(class_id: str, db_name: str) -> Optional[Dict[str, Any]]:
|
||||
def get_lesson_node(lesson_id: str, db_name: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get a specific lesson node."""
|
||||
query = """
|
||||
MATCH (l:TimetableLesson {unique_id: $lesson_id})
|
||||
MATCH (l:TimetableLesson {uuid_string: $lesson_id})
|
||||
RETURN {
|
||||
id: l.unique_id,
|
||||
path: l.path,
|
||||
id: l.uuid_string,
|
||||
path: l.node_storage_path,
|
||||
start_time: l.start_time,
|
||||
__primarylabel__: 'TimetableLesson'
|
||||
} as node
|
||||
@@ -473,8 +473,8 @@ def get_current_lesson(db_name: str) -> Optional[Dict[str, Any]]:
|
||||
MATCH (l:TimetableLesson)
|
||||
WHERE l.start_time >= $now
|
||||
RETURN {
|
||||
id: l.unique_id,
|
||||
path: l.path,
|
||||
id: l.uuid_string,
|
||||
path: l.node_storage_path,
|
||||
start_time: l.start_time,
|
||||
__primarylabel__: 'TimetableLesson'
|
||||
} as node
|
||||
|
||||
Reference in New Issue
Block a user