service backend
All checks were successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful

This commit is contained in:
Stephan D
2025-11-07 18:35:26 +01:00
parent 20e8f9acc4
commit 62a6631b9a
537 changed files with 48453 additions and 0 deletions

35
api/pkg/model/comment.go Normal file
View File

@@ -0,0 +1,35 @@
package model
import (
"github.com/tech/sendico/pkg/mservice"
"go.mongodb.org/mongo-driver/bson/primitive"
)
type CommentBase struct {
PermissionBound `bson:",inline" json:",inline"`
AuthorRef primitive.ObjectID `bson:"authorRef" json:"authorRef"` // Reference to the author (user) of the comment
TaskRef primitive.ObjectID `bson:"taskRef" json:"taskRef"` // Reference to the task
Attachments []Attachment `bson:"attachments" json:"attachments"` // List of attachments
Reactions []Reaction `bson:"reactions" json:"reactions"` // List of attachments
Content string `bson:"content" json:"content"` // Text content
IsFormatted bool `bson:"isFormatted" json:"isFormatted"` // Flag for formatted content
}
func (*CommentBase) Collection() string {
return mservice.Comments
}
// Comment represents a comment attached to a task.
type Comment struct {
CommentBase `bson:",inline" json:",inline"`
}
// NewTaskComment creates a new instance of TaskComment.
func NewComment(taskRef, authorRef primitive.ObjectID, content string) *Comment {
return &Comment{
CommentBase: CommentBase{
AuthorRef: authorRef,
Content: content,
},
}
}