models

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package models is a package that contains the models for the microservice

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Folder

type Folder struct {
	ID        *primitive.ObjectID `bson:"_id" json:"id"`
	Name      string              `bson:"name" json:"name" binding:"required"`
	Color     *string             `bson:"color" json:"color"`
	ParentID  *primitive.ObjectID `bson:"parent_id" json:"parentId"`
	UserID    primitive.ObjectID  `bson:"user_id" json:"userId"`
	Emoji     *string             `bson:"emoji" json:"emoji"`
	CreatedAt *primitive.DateTime `bson:"created_at,omitempty" json:"createdAt,omitempty"`
	UpdatedAt *primitive.DateTime `bson:"updated_at,omitempty" json:"updatedAt,omitempty"`
}

Folder represents a folder in the application

type Mail

type Mail struct {
	ID             *primitive.ObjectID    `bson:"_id,omitempty" json:"id,omitempty"`
	UserID         primitive.ObjectID     `bson:"user_id" json:"userId"`
	Headers        map[string]interface{} `bson:"headers" json:"headers"`
	TextContent    string                 `bson:"text_content" json:"textContent"`
	HTMLContent    string                 `bson:"html_content" json:"htmlContent"`
	CalendarEvent  *primitive.ObjectID    `bson:"calendar_event,omitempty" json:"calendarEvent,omitempty"`
	Attachments    []MailAttachment       `bson:"attachments,omitempty" json:"attachments,omitempty"`
	Read           *bool                  `bson:"read,omitempty" json:"read,omitempty"`
	InReplyTo      *primitive.ObjectID    `bson:"in_reply_to,omitempty" json:"inReplyTo,omitempty"`
	Archived       *bool                  `bson:"archived,omitempty" json:"archived,omitempty"`
	Trashed        *bool                  `bson:"trashed,omitempty" json:"trashed,omitempty"`
	TrashedAt      *primitive.DateTime    `bson:"trashed_at,omitempty" json:"trashedAt,omitempty"`
	Greylisted     *bool                  `bson:"graylisted,omitempty" json:"graylisted,omitempty"`
	Rejected       *bool                  `bson:"rejected,omitempty" json:"rejected,omitempty"`
	RewriteSubject *bool                  `bson:"rewrite_subject,omitempty" json:"rewriteSubject,omitempty"`
	CreatedAt      *primitive.DateTime    `bson:"created_at,omitempty" json:"createdAt,omitempty"`
	UpdatedAt      *primitive.DateTime    `bson:"updated_at,omitempty" json:"updatedAt,omitempty"`
}

Mail represents a mail message

type MailAttachment

type MailAttachment struct {
	Filename    string `bson:"filename" json:"filename"`
	ContentType string `bson:"content_type" json:"content_type"`
	StoragePath string `bson:"storage_path" json:"storage_path"` // S3 storage key/reference
	StorageType string `bson:"storage_type" json:"storage_type"` // S3, MongoDB, etc.
	Size        int64  `bson:"size" json:"size"`                 // File size in bytes
}

MailAttachment represents a file attachment

type RawAttachment

type RawAttachment struct {
	Filename    string
	ContentType string
	Data        []byte
}

RawAttachment represents a file attachment

type RawMail

type RawMail struct {
	Headers        map[string]interface{} `json:"headers" binding:"required"`
	TextContent    string                 `json:"textContent"`
	HTMLContent    string                 `json:"htmlContent"`
	Attachments    []RawAttachment        `json:"attachments"`
	InReplyTo      *string                `json:"inReplyTo"`
	Rejected       bool                   `json:"rejected"`
	RewriteSubject bool                   `json:"rewriteSubject"`
	Greylisted     bool                   `json:"graylisted"`
}

RawMail represents the collected content from an email

func (*RawMail) Encrypt

func (m *RawMail) Encrypt(publicKey string) (*RawMail, error)

Encrypt encrypts the content using the age encryption library

func (*RawMail) ToMailEntity

func (m *RawMail) ToMailEntity() *Mail

ToMailEntity converts a RawMail to a Mail entity

func (*RawMail) ToMessageEntity

func (m *RawMail) ToMessageEntity() (*message.Entity, error)

ToMessageEntity creates a proper email message using go-message library

type SendMail

type SendMail struct {
	ID            primitive.ObjectID  `bson:"_id" json:"id"`
	Mail          *Mail               `bson:"mail" json:"mail"`
	SendStatus    SendStatus          `bson:"send_status" json:"send_status"`
	RetryCounter  *int                `bson:"retry_counter,omitempty" json:"retry_counter,omitempty"`
	FailureReason *string             `bson:"failure_reason,omitempty" json:"failure_reason,omitempty"`
	FailedAt      *primitive.DateTime `bson:"failed_at,omitempty" json:"failed_at,omitempty"`
	Trashed       bool                `bson:"trashed" json:"trashed"`
	CreatedAt     *primitive.DateTime `bson:"created_at" json:"created_at"`
	UpdatedAt     *primitive.DateTime `bson:"updated_at" json:"updated_at"`
}

SendMail represents a mail that has been sent or is queued to be sent

type SendStatus

type SendStatus string

SendStatus represents the status of a sent mail

const (
	// SendStatusPending represents a mail that is pending to be sent
	SendStatusPending SendStatus = "pending"
	// SendStatusSent represents a mail that has been sent
	SendStatusSent SendStatus = "sent"
	// SendStatusFailed represents a mail that has failed to be sent
	SendStatusFailed SendStatus = "failed"
	// SendStatusRetry represents a mail that has failed to be sent and is being retried
	SendStatusRetry SendStatus = "retry"
)

type Tag

type Tag struct {
	ID        *primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	UserID    *primitive.ObjectID `json:"userId" bson:"user_id,omitempty"`
	Name      string              `json:"name" bson:"name" binding:"required"`
	Color     *string             `json:"color" bson:"color"`
	CreatedAt *primitive.DateTime `json:"createdAt" bson:"created_at"`
	UpdatedAt *primitive.DateTime `json:"updatedAt" bson:"updated_at"`
}

Tag represents a tag associated with a task

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL