Files
sendico/api/pkg/model/comment.go
Stephan D 62a6631b9a
All checks were successful
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/nats Pipeline was successful
service backend
2025-11-07 18:35:26 +01:00

36 lines
1.2 KiB
Go

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,
},
}
}