models

package
v0.1.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ValidPurchaseTypes = []string{
	"REVENUE_CAT",
}

ValidPurchaseTypes is used in validators.go

Functions

func RegisterValidators

func RegisterValidators()

RegisterValidators registers custom validators for the models

func ValidatePurchaseType

func ValidatePurchaseType(fl validator.FieldLevel) bool

ValidatePurchaseType checks if the purchase type is in the allowed list

Types

type Attribute

type Attribute struct {
	UpdatedAtMs int64  `json:"updated_at_ms"`
	Value       string `json:"value"`
}

Attribute represents a subscriber attribute in RevenueCat

type EncryptionKey

type EncryptionKey struct {
	UserKey      string `json:"userKey" bson:"user_key"`
	BackupKey    string `json:"backupKey" bson:"backup_key"`
	Salt         string `json:"salt" bson:"salt"`
	MnemonicSalt string `json:"mnemonicSalt" bson:"mnemonic_salt"`
}

EncryptionKey represents the structure for encryption keys for a user

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" json:"id"`
	UserID         primitive.ObjectID  `bson:"user_id" json:"user_id"`
	Headers        MailHeaders         `bson:"headers" json:"headers"`
	TextContent    string              `bson:"text_content" json:"text_content"`
	HTMLContent    string              `bson:"html_content" json:"html_content"`
	Attachments    []MailAttachment    `bson:"attachments" json:"attachments"`
	Archived       bool                `bson:"archived" json:"archived"`
	Trashed        bool                `bson:"trashed" json:"trashed"`
	Greylisted     bool                `bson:"graylisted" json:"graylisted"`
	Rejected       bool                `bson:"rejected" json:"rejected"`
	RewriteSubject bool                `bson:"rewrite_subject" json:"rewrite_subject"`
	CreatedAt      *primitive.DateTime `bson:"created_at" json:"created_at"`
	UpdatedAt      *primitive.DateTime `bson:"updated_at" json:"updated_at"`
}

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 MailHeaders

type MailHeaders struct {
	From      string `bson:"from" json:"from"`
	To        string `bson:"to" json:"to"`
	Subject   string `bson:"subject" json:"subject"`
	Date      string `bson:"date" json:"date"`
	MessageID string `bson:"message_id" json:"message_id"`
	Cc        string `bson:"cc" json:"cc"`
	Bcc       string `bson:"bcc" json:"bcc"`
}

MailHeaders represents the email headers

type PurchaseEntity

type PurchaseEntity struct {
	ID           primitive.ObjectID     `json:"id" bson:"_id,omitempty"`
	Type         *string                `json:"type" bson:"type" binding:"required,validPurchaseType"`
	PurchaseData RevenueCatPurchaseData `json:"purchaseData" bson:"purchase_data"`
	CreatedAt    primitive.DateTime     `json:"createdAt" bson:"created_at"`
	UpdatedAt    primitive.DateTime     `json:"updatedAt" bson:"updated_at"`
}

PurchaseEntity represents a generic purchase record

func NewRevenueCatPurchase

func NewRevenueCatPurchase(rcData RevenueCatPurchaseData) PurchaseEntity

NewRevenueCatPurchase creates a new PurchaseEntity with RevenueCat data

type RevenueCatPayload

type RevenueCatPayload struct {
	APIVersion string                 `json:"api_version"`
	Event      RevenueCatPurchaseData `json:"event"`
}

RevenueCatPayload represents the structure of a RevenueCat webhook payload

type RevenueCatPurchaseData

type RevenueCatPurchaseData struct {
	Aliases                  []string             `json:"aliases"`
	AppID                    string               `json:"app_id"`
	AppUserID                string               `json:"app_user_id"`
	CommissionPercentage     float64              `json:"commission_percentage"`
	CountryCode              string               `json:"country_code"`
	Currency                 string               `json:"currency"`
	EntitlementID            string               `json:"entitlement_id"`
	EntitlementIDs           []string             `json:"entitlement_ids"`
	Environment              string               `json:"environment"`
	EventTimestampMs         int64                `json:"event_timestamp_ms"`
	ExpirationAtMs           int64                `json:"expiration_at_ms"`
	ID                       string               `json:"id"`
	IsFamilyShare            bool                 `json:"is_family_share"`
	OfferCode                string               `json:"offer_code"`
	OriginalAppUserID        string               `json:"original_app_user_id"`
	OriginalTransactionID    string               `json:"original_transaction_id"`
	PeriodType               string               `json:"period_type"`
	PresentedOfferingID      string               `json:"presented_offering_id"`
	Price                    float64              `json:"price"`
	PriceInPurchasedCurrency float64              `json:"price_in_purchased_currency"`
	ProductID                string               `json:"product_id"`
	PurchasedAtMs            int64                `json:"purchased_at_ms"`
	Store                    string               `json:"store"`
	SubscriberAttributes     map[string]Attribute `json:"subscriber_attributes"`
	TakehomePercentage       float64              `json:"takehome_percentage"`
	TaxPercentage            float64              `json:"tax_percentage"`
	TransactionID            string               `json:"transaction_id"`
	Type                     string               `json:"type"`
}

RevenueCatPurchaseData represents RevenueCat specific purchase data

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 UserDevice

type UserDevice struct {
	DeviceID       string  `json:"deviceId" bson:"device_id" binding:"required"`
	DeviceName     string  `json:"deviceName" bson:"device_name" binding:"required"`
	FcmToken       string  `json:"fcmToken" bson:"fcm_token" binding:"required"`
	DeviceTimezone *string `json:"deviceTimezone" bson:"device_timezone"`
}

UserDevice represents a user's device information for push notifications.

type UserEntity

type UserEntity struct {
	ID                *primitive.ObjectID   `json:"id" bson:"_id"`
	Email             *string               `json:"email" bson:"email" binding:"required"`
	Password          *string               `json:"password,omitempty" bson:"password" binding:"required"`
	KeySet            *EncryptionKey        `json:"keySet,omitempty" bson:"key_set" binding:"required"`
	RoleIds           []*primitive.ObjectID `json:"-" bson:"role_ids"`
	Roles             []*UserRoleEntity     `json:"roles" bson:"roles,omitempty"`
	ResetPasswordCode *string               `json:"resetPasswordCode,omitempty" bson:"reset_password_code"`
	Devices           []*UserDevice         `json:"devices" bson:"devices,omitempty"`
	Purchases         []*PurchaseEntity     `json:"purchases" bson:"purchases,omitempty"`
	CreatedAt         *primitive.DateTime   `json:"createdAt" bson:"created_at"`
	UpdatedAt         *primitive.DateTime   `json:"updatedAt" bson:"updated_at"`
}

UserEntity represents a user in the system @Summary User entity @Description Represents a user in the system

type UserRoleEntity

type UserRoleEntity struct {
	ID        *primitive.ObjectID `json:"id" bson:"_id"`
	Name      string              `json:"name" bson:"name" binding:"required"`
	CreatedAt *primitive.DateTime `json:"createdAt" bson:"created_at"`
	UpdatedAt *primitive.DateTime `json:"updatedAt" bson:"updated_at"`
}

UserRoleEntity represents a user role in the system @Summary User role entity @Description Represents a user role in the system

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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