models

package
v0.1.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: 3 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 CalAddress added in v0.1.0

type CalAddress struct {
	Email    string `json:"email" bson:"email"`                            // mailto: address without the "mailto:" prefix
	CN       string `json:"cn,omitempty" bson:"cn,omitempty"`              // Common Name
	Role     string `json:"role,omitempty" bson:"role,omitempty"`          // ROLE=REQ-PARTICIPANT / OPTIONAL / NON-PARTICIPANT
	PartStat string `json:"partStat,omitempty" bson:"part_stat,omitempty"` // PARTSTAT=ACCEPTED/TENTATIVE/DECLINED
	RSVP     bool   `json:"rsvp,omitempty" bson:"rsvp,omitempty"`          // RSVP=TRUE/FALSE
}

CalAddress represents ORGANIZER and ATTENDEE fields.

type Calendar added in v0.1.0

type Calendar struct {
	ID        *primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	UserID    *primitive.ObjectID `json:"userId" bson:"user_id,omitempty"`
	Name      *string             `json:"name,omitempty" bson:"name,omitempty"`
	ProdID    string              `json:"prodId,omitempty" bson:"-"` // PRODID (required)
	Version   string              `json:"version" bson:"-"`          // VERSION (must be "2.0")
	Method    string              `json:"method,omitempty" bson:"-"` // METHOD (optional, used for iTIP: REQUEST/PUBLISH/etc.)
	Events    []Event             `json:"events,omitempty" bson:"-"` // VEVENT components
	Timezones []VTimezone         `json:"timezones,omitempty" bson:"timezones,omitempty"`
	CreatedAt *primitive.DateTime `json:"createdAt,omitempty" bson:"created_at,omitempty"`
	UpdatedAt *primitive.DateTime `json:"updatedAt,omitempty" bson:"updated_at,omitempty"`
}

Calendar represents an RFC 5545 VCALENDAR object.

type Event added in v0.1.0

type Event struct {
	ID           primitive.ObjectID  `json:"id" bson:"_id"`
	UID          string              // UID (required)
	UserID       primitive.ObjectID  `json:"userId" bson:"user_id"`                                 // Reference to owning user
	DTStamp      time.Time           `json:"dtStamp" bson:"dt_stamp"`                               // DTSTAMP (required)
	Start        *TimeSpec           `json:"start,omitempty" bson:"start,omitempty"`                // DTSTART (recommended)
	End          *TimeSpec           `json:"end,omitempty" bson:"end,omitempty"`                    // DTEND (optional)
	Duration     *time.Duration      `json:"duration,omitempty" bson:"duration,omitempty"`          // DURATION (optional, alternative to DTEND)
	Summary      string              `json:"summary,omitempty" bson:"summary,omitempty"`            // SUMMARY
	Description  string              `json:"description,omitempty" bson:"description,omitempty"`    // DESCRIPTION
	Location     *string             `json:"location,omitempty" bson:"location,omitempty"`          // LOCATION
	Organizer    *CalAddress         `json:"organizer,omitempty" bson:"organizer,omitempty"`        // ORGANIZER
	Attendees    []CalAddress        `json:"attendees,omitempty" bson:"attendees,omitempty"`        // ATTENDEE
	Recurrence   *RRule              `json:"recurrence,omitempty" bson:"recurrence,omitempty"`      // RRULE
	ExDates      []TimeSpec          `json:"exDates,omitempty" bson:"ex_dates,omitempty"`           // EXDATE
	RDates       []TimeSpec          `json:"rDates,omitempty" bson:"r_dates,omitempty"`             // RDATE
	Status       string              `json:"status,omitempty" bson:"status,omitempty"`              // STATUS: CONFIRMED / TENTATIVE / CANCELLED
	Sequence     int                 `json:"sequence,omitempty" bson:"sequence,omitempty"`          // SEQUENCE (increments on update)
	LastModified *time.Time          `json:"lastModified,omitempty" bson:"last_modified,omitempty"` // LAST-MODIFIED
	CalendarID   *primitive.ObjectID `json:"calendarId,omitempty" bson:"calendar_id,omitempty"`     // Reference to parent calendar in DB
	CreatedAt    *primitive.DateTime `json:"createdAt,omitempty" bson:"created_at,omitempty"`
	UpdatedAt    *primitive.DateTime `json:"updatedAt,omitempty" bson:"updated_at,omitempty"`
}

Event represents an RFC 5545 VEVENT object.

func (*Event) Encrypt added in v0.1.0

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

Encrypt encrypts the event fields using the age encryption library

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 RRule added in v0.1.0

type RRule struct {
	Freq     string     `json:"freq" bson:"freq"`                             // FREQ=DAILY/WEEKLY/MONTHLY/YEARLY
	Interval int        `json:"interval,omitempty" bson:"interval,omitempty"` // INTERVAL=n
	Until    *time.Time `json:"until,omitempty" bson:"until,omitempty"`
	Count    int        `json:"count,omitempty" bson:"count,omitempty"`
	ByDay    []string   `json:"byDay,omitempty" bson:"by_day,omitempty"` // e.g. MO,WE,FR
	ByMonth  []int      `json:"byMonth,omitempty" bson:"by_month,omitempty"`
	BySetPos []int      `json:"bySetPos,omitempty" bson:"by_set_pos,omitempty"`
}

RRule represents the RFC 5545 recurrence rule.

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

type TimeSpec added in v0.1.0

type TimeSpec struct {
	Time time.Time `json:"time" bson:"time"`
	TZID string    `json:"tzid,omitempty" bson:"tzid,omitempty"` // empty means floating or UTC depending on Time.Location
}

TimeSpec represents a date or date-time with an optional timezone. RFC 5545 allows floating times, UTC times, or TZID-bound times.

type VTimezone added in v0.1.0

type VTimezone struct {
	TZID   string `json:"tzid" bson:"tzid"`
	Offset int    `json:"offset,omitempty" bson:"offset,omitempty"` // offset from UTC in seconds (simplified model)
}

VTimezone represents VTIMEZONE blocks. Minimal version; can be extended if needed.

Jump to

Keyboard shortcuts

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