From 05c9c07e196259b1ff45551df5774b9e2044407c Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 6 Jun 2026 23:29:59 +0200 Subject: [PATCH] docs(api/v2): add doc/readOnly tags to notification model fields --- pkg/models/notifications_database.go | 2 +- pkg/notifications/database.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/models/notifications_database.go b/pkg/models/notifications_database.go index 3d430b971..aaa71103c 100644 --- a/pkg/models/notifications_database.go +++ b/pkg/models/notifications_database.go @@ -28,7 +28,7 @@ type DatabaseNotifications struct { // Whether or not to mark this notification as read or unread. // True is read, false is unread. - Read bool `xorm:"-" json:"read"` + Read bool `xorm:"-" json:"read" doc:"Set true to mark the notification read, false to mark it unread."` web.CRUDable `xorm:"-" json:"-"` web.Permissions `xorm:"-" json:"-"` diff --git a/pkg/notifications/database.go b/pkg/notifications/database.go index b007d8a54..c944e2f7b 100644 --- a/pkg/notifications/database.go +++ b/pkg/notifications/database.go @@ -28,22 +28,22 @@ import ( // DatabaseNotification represents a notification that was saved to the database type DatabaseNotification struct { // The unique, numeric id of this notification. - ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"notificationid"` + ID int64 `xorm:"bigint autoincr not null unique pk" json:"id" param:"notificationid" readOnly:"true" doc:"The unique, numeric id of this notification."` // The ID of the notifiable this notification is associated with. NotifiableID int64 `xorm:"bigint not null" json:"-"` // The actual content of the notification. - Notification interface{} `xorm:"json not null" json:"notification"` + Notification interface{} `xorm:"json not null" json:"notification" readOnly:"true" doc:"The notification payload. Shape depends on the notification's name."` // The name of the notification - Name string `xorm:"varchar(250) index not null" json:"name"` + Name string `xorm:"varchar(250) index not null" json:"name" readOnly:"true" doc:"The name identifying the kind of notification."` // The thing the notification is about. Used to check if a notification for this thing already happened or not. SubjectID int64 `xorm:"bigint null" json:"-"` // When this notification is marked as read, this will be updated with the current timestamp. - ReadAt time.Time `xorm:"datetime null" json:"read_at"` + ReadAt time.Time `xorm:"datetime null" json:"read_at" readOnly:"true" doc:"When the notification was marked read; zero value while unread. Set via the read flag, not written directly."` // A timestamp when this notification was created. You cannot change this value. - Created time.Time `xorm:"created not null" json:"created"` + Created time.Time `xorm:"created not null" json:"created" readOnly:"true" doc:"A timestamp when this notification was created. You cannot change this value."` } // AfterInsert is called by XORM after the row is inserted. For transactional