models

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateTaskRequest added in v1.2.0

type CreateTaskRequest struct {
	Name          *string                 `json:"name" binding:"required"`
	WebhookID     *uint                   `json:"webhook_id" binding:"required"`
	Service       *string                 `json:"service" binding:"required"`
	ServiceParams *map[string]interface{} `json:"service_params" binding:"-"`
}

type CreateUserRequest added in v1.2.0

type CreateUserRequest struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type CreateWebhookRequest added in v1.2.0

type CreateWebhookRequest struct {
	Name  *string `json:"name" binding:"required"`
	Tasks *[]Task `json:"tasks" binding:"-"`
}

type LoginUserRequest added in v1.2.0

type LoginUserRequest struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type Task

type Task struct {
	ID              uint                   `json:"id" gorm:"primaryKey"`
	Webhook         *Webhook               `json:"webhook" gorm:"foreignKey:WebhookID;constraint:OnDelete:CASCADE;"`
	WebhookID       uint                   `json:"-"`
	Name            string                 `json:"name" gorm:"size:255"`
	Service         string                 `json:"service" gorm:"size:255"`
	ServiceParams   map[string]interface{} `json:"service_params" gorm:"-"`
	ServiceParamsDB string                 `json:"-"` // Database field
	CreatedAt       time.Time              `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt       time.Time              `json:"updated_at" gorm:"autoUpdateTime"`
}

func (*Task) AfterFind added in v1.1.0

func (t *Task) AfterFind(tx *gorm.DB) (err error)

func (*Task) BeforeSave added in v1.1.0

func (t *Task) BeforeSave(tx *gorm.DB) (err error)

func (*Task) Update added in v1.2.0

func (t *Task) Update(request UpdateTaskRequest)

type UpdateRequest added in v1.2.0

type UpdateRequest struct {
	IPv4 netip.Addr `json:"ipv4"`
	IPv6 netip.Addr `json:"ipv6"`
}

type UpdateResult

type UpdateResult struct {
	Success bool   `json:"success"`
	Task    string `json:"task"`
	Message string `json:"message"`
}

type UpdateTaskRequest added in v1.2.0

type UpdateTaskRequest struct {
	Name          *string                 `json:"name" binding:"-"`
	Service       *string                 `json:"service" binding:"-"`
	ServiceParams *map[string]interface{} `json:"service_params" binding:"-"`
}

type UpdateWebhookRequest added in v1.2.0

type UpdateWebhookRequest struct {
	Name  *string `json:"name" binding:"-"`
	Token *string `json:"token" binding:"-"`
	Tasks *[]Task `json:"tasks" binding:"-"`
}

type User

type User struct {
	ID        uuid.UUID `json:"id" gorm:"primaryKey"`
	Username  string    `json:"username" gorm:"unique;size:255" binding:"required"`
	Password  string    `json:"password,omitempty" gorm:"size:255" binding:"required"`
	CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
}

func (User) MarshalJSON

func (u User) MarshalJSON() ([]byte, error)

type Webhook

type Webhook struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	Name      string    `json:"name" gorm:"size:255"`
	Owner     uuid.UUID `json:"user_id" gorm:"not null"`
	Token     string    `json:"token" gorm:"size:255"`
	IPv4      string    `json:"ipv4" gorm:"size:255"`
	IPv6      string    `json:"ipv6" gorm:"size:255"`
	Tasks     []Task    `json:"tasks" gorm:"foreignKey:WebhookID;constraint:OnDelete:CASCADE;"`
	CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
	UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
}

func (*Webhook) Update added in v1.2.0

func (w *Webhook) Update(request UpdateWebhookRequest)

Jump to

Keyboard shortcuts

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