Files
Krow-workspace/backend/dataconnect/connector/activityLog/queries.gql
2026-01-19 19:18:11 -05:00

176 lines
3.0 KiB
GraphQL

# ----------------------------------------------------------
# LIST ALL (admin/debug)
# ----------------------------------------------------------
query listActivityLogs(
$offset: Int
$limit: Int
) @auth(level: USER) {
activityLogs(offset: $offset, limit: $limit) {
id
userId
date
hourStart
hourEnd
totalhours
iconType
iconColor
title
description
isRead
activityType
createdAt
updatedAt
createdBy
}
}
# ----------------------------------------------------------
# GET BY ID
# ----------------------------------------------------------
query getActivityLogById($id: UUID!) @auth(level: USER) {
activityLog(id: $id) {
id
userId
date
hourStart
hourEnd
totalhours
iconType
iconColor
title
description
isRead
activityType
createdAt
updatedAt
createdBy
}
}
# ----------------------------------------------------------
# LIST BY USER
# ----------------------------------------------------------
query listActivityLogsByUserId(
$userId: String!
$offset: Int
$limit: Int
) @auth(level: USER) {
activityLogs(
where: { userId: { eq: $userId } }
offset: $offset
limit: $limit
orderBy: { date: DESC }
) {
id
userId
date
hourStart
hourEnd
totalhours
iconType
iconColor
title
description
isRead
activityType
createdAt
updatedAt
createdBy
}
}
# ----------------------------------------------------------
# LIST UNREAD BY USER (common for notifications UI)
# ----------------------------------------------------------
query listUnreadActivityLogsByUserId(
$userId: String!
$offset: Int
$limit: Int
) @auth(level: USER) {
activityLogs(
where: {
userId: { eq: $userId }
isRead: { eq: false }
}
offset: $offset
limit: $limit
orderBy: { date: DESC }
) {
id
userId
date
hourStart
hourEnd
totalhours
iconType
iconColor
title
description
isRead
activityType
createdAt
updatedAt
createdBy
}
}
# ----------------------------------------------------------
# FILTER (user + date range + read status + type)
# NOTE: Timestamp filter uses ge/le (NOT gte/lte)
# ----------------------------------------------------------
query filterActivityLogs(
$userId: String
$dateFrom: Timestamp
$dateTo: Timestamp
$isRead: Boolean
$activityType: ActivityType
$iconType: ActivityIconType
$offset: Int
$limit: Int
) @auth(level: USER) {
activityLogs(
where: {
userId: { eq: $userId }
date: { ge: $dateFrom, le: $dateTo }
isRead: { eq: $isRead }
activityType: { eq: $activityType }
iconType: { eq: $iconType }
}
offset: $offset
limit: $limit
orderBy: { date: DESC }
) {
id
userId
date
hourStart
hourEnd
totalhours
iconType
iconColor
title
description
isRead
activityType
createdAt
updatedAt
createdBy
}
}