service backend
This commit is contained in:
35
api/pkg/model/comment.go
Normal file
35
api/pkg/model/comment.go
Normal 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,
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user