chore(legacy): relocate v1 dataconnect source

This commit is contained in:
zouantchaw
2026-03-18 15:04:18 +01:00
parent c9e917bed5
commit 1d850811c4
164 changed files with 55 additions and 26 deletions

View File

@@ -0,0 +1,96 @@
mutation createActivityLog(
$userId: String!
$date: Timestamp!
$hourStart: String
$hourEnd: String
$totalhours: String
$iconType: ActivityIconType
$iconColor: String
$title: String!
$description: String!
$isRead: Boolean
$activityType: ActivityType!
) @auth(level: USER) {
activityLog_insert(
data: {
userId: $userId
date: $date
hourStart: $hourStart
hourEnd: $hourEnd
totalhours: $totalhours
iconType: $iconType
iconColor: $iconColor
title: $title
description: $description
isRead: $isRead
activityType: $activityType
}
)
}
mutation updateActivityLog(
$id: UUID!
$userId: String
$date: Timestamp
$hourStart: String
$hourEnd: String
$totalhours: String
$iconType: ActivityIconType
$iconColor: String
$title: String
$description: String
$isRead: Boolean
$activityType: ActivityType
) @auth(level: USER) {
activityLog_update(
id: $id
data: {
userId: $userId
date: $date
hourStart: $hourStart
hourEnd: $hourEnd
totalhours: $totalhours
iconType: $iconType
iconColor: $iconColor
title: $title
description: $description
isRead: $isRead
activityType: $activityType
}
)
}
# ----------------------------------------------------------
# MARK AS READ (single)
# ----------------------------------------------------------
mutation markActivityLogAsRead($id: UUID!) @auth(level: USER) {
activityLog_update(
id: $id
data: { isRead: true }
)
}
# ----------------------------------------------------------
# MARK MANY AS READ (correct op name in your DC)
# ----------------------------------------------------------
mutation markActivityLogsAsRead(
$ids: [UUID!]!
) @auth(level: USER) {
activityLog_updateMany(
where: { id: { in: $ids } }
data: { isRead: true }
)
}
mutation deleteActivityLog($id: UUID!) @auth(level: USER) {
activityLog_delete(id: $id)
}

View File

@@ -0,0 +1,175 @@
# ----------------------------------------------------------
# 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
}
}