notes

package
v0.0.0-...-293bb56 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(
	h *NoteHandler,
	e *echo.Group,
)

Types

type BulkNoteOperationPayload

type BulkNoteOperationPayload struct {
	Operations []NoteOperation `json:"operations"`
}

type LinkedNote

type LinkedNote struct {
	Title string `json:"Title"`
	ID    int32  `json:"ID"`
}

type NoteDeletePayload

type NoteDeletePayload struct {
	UserID int32  `json:"user_id" validate:"required"`
	Title  string `json:"title"   validate:"required"`
}

type NoteHandler

type NoteHandler struct {
	// contains filtered or unexported fields
}

func NewNoteHandler

func NewNoteHandler(
	cfg *config.Config,
	cache *cache.Cache,
	validator *validate.Validator,
	service *NoteService,
) *NoteHandler

func (*NoteHandler) All

func (h *NoteHandler) All(c echo.Context) error

func (*NoteHandler) BulkOperations

func (h *NoteHandler) BulkOperations(c echo.Context) error

func (*NoteHandler) Create

func (h *NoteHandler) Create(c echo.Context) error

func (*NoteHandler) Delete

func (h *NoteHandler) Delete(c echo.Context) error

func (*NoteHandler) DeleteByTitle

func (h *NoteHandler) DeleteByTitle(c echo.Context) error

func (*NoteHandler) Read

func (h *NoteHandler) Read(c echo.Context) error

func (*NoteHandler) SearchNotes

func (h *NoteHandler) SearchNotes(c echo.Context) error

func (*NoteHandler) Update

func (h *NoteHandler) Update(c echo.Context) error

func (*NoteHandler) UpdateByTitle

func (h *NoteHandler) UpdateByTitle(c echo.Context) error

func (*NoteHandler) Validator

func (h *NoteHandler) Validator() *validate.Validator

type NoteOperation

type NoteOperation struct {
	Operation     string             `json:"operation"`
	UpdatePayload *NotePayload       `json:"update_payload,omitempty"`
	DeletePayload *NoteDeletePayload `json:"delete_payload,omitempty"`
}

type NotePayload

type NotePayload struct {
	Title    string   `json:"title"       validate:"required"`
	NewTitle string   `json:"new_title"`
	Tags     []string `json:"tags"`
	UserID   int32    `json:"user_id"     validate:"required"`
	VaultID  int32    `json:"vault_id"    validate:"required"`
	Upstream *int32   `json:"upstream_id"`
	Links    []int32  `json:"links"`
	Content  string   `json:"content"     validate:"required"`
}

type NoteService

type NoteService struct {
	// contains filtered or unexported fields
}

func NewNoteService

func NewNoteService(db *db.Queries) *NoteService

func (*NoteService) All

func (s *NoteService) All(ctx context.Context, id int) ([]db.GetNotesByUserRow, error)

func (*NoteService) Create

func (s *NoteService) Create(
	ctx context.Context,
	payload NotePayload,
) (db.CreateNoteRow, error)

func (*NoteService) Delete

func (s *NoteService) Delete(ctx context.Context, id int) error

func (*NoteService) DeleteByTitle

func (s *NoteService) DeleteByTitle(
	ctx context.Context,
	payload NoteDeletePayload,
) error

func (*NoteService) Read

func (s *NoteService) Read(ctx context.Context, id int) (db.GetNoteRow, error)

func (*NoteService) SearchNotes

func (s *NoteService) SearchNotes(
	ctx context.Context,
	vaultID pgtype.Int4,
	searchQuery string,
) ([]db.SearchNotesRow, error)

func (*NoteService) Update

func (s *NoteService) Update(
	id int,
	ctx context.Context,
	payload NotePayload,
) (db.UpdateNoteRow, error)

func (*NoteService) UpdateByTitle

func (s *NoteService) UpdateByTitle(
	ctx context.Context,
	payload NotePayload,
) (db.UpdateNoteByTitleRow, error)

type NoteWithDetails

type NoteWithDetails struct {
	ID          int32              `json:"id"`
	Title       string             `json:"title"`
	UserID      pgtype.Int4        `json:"userId"`
	VaultID     pgtype.Int4        `json:"vaultId"`
	Upstream    pgtype.Int4        `json:"upstream"`
	Content     string             `json:"content"`
	CreatedAt   pgtype.Timestamptz `json:"createdAt"`
	UpdatedAt   pgtype.Timestamptz `json:"updatedAt"`
	Tags        []Tag              `json:"tags"`
	LinkedNotes []LinkedNote       `json:"linkedNotes"`
}

type Tag

type Tag struct {
	Name string `json:"name"`
	ID   int32  `json:"id"`
}

Jump to

Keyboard shortcuts

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