note

package
v0.0.0-...-9139af7 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUpdateUserNoteStarNotFound = gonethttpresponse.NewFailResponseError(
		"note_id",
		"note not found",
		nil,
		http.StatusNotFound,
	)
	ErrUpdateUserNoteTrashNotFound = gonethttpresponse.NewFailResponseError(
		"note_id",
		"note not found",
		nil,
		http.StatusNotFound,
	)
	ErrUpdateUserNoteArchiveNotFound = gonethttpresponse.NewFailResponseError(
		"note_id",
		"note not found",
		nil,
		http.StatusNotFound,
	)
	ErrUpdateUserNotePinNotFound = gonethttpresponse.NewFailResponseError(
		"note_id",
		"note not found",
		nil,
		http.StatusNotFound,
	)
	ErrGetUserNoteByIDNotFound = gonethttpresponse.NewFailResponseError(
		"note_id",
		"note not found",
		nil,
		http.StatusNotFound,
	)
	ErrUpdateUserNoteNotFound = gonethttpresponse.NewFailResponseError(
		"note_id",
		"note not found",
		nil,
		http.StatusNotFound,
	)
	ErrDeleteUserNoteNotFound = gonethttpresponse.NewFailResponseError(
		"note_id",
		"note not found",
		nil,
		http.StatusNotFound,
	)
)
View Source
var (
	Service    = &service{}
	Controller = &controller{}
	Module     = &gonethttp.Module{
		Pattern:    "/note",
		Service:    Service,
		Controller: Controller,
		BeforeLoadFn: func(m *gonethttp.Module) {
			m.Middlewares = gonethttp.NewMiddlewares(
				internalmiddleware.AuthenticateAccessToken,
			)
		},
		Submodules: gonethttp.NewSubmodules(
			internalrouterapiv1noteversion.Module,
			internalrouterapiv1noteversions.Module,
			internalrouterapiv1notetags.Module,
		),
		RegisterRoutesFn: func(m *gonethttp.Module) {
			m.RegisterExactRoute(
				"POST /",
				Controller.CreateUserNote,
				internalmiddleware.Validate(
					&CreateUserNoteRequest{},
				),
			)
			m.RegisterExactRoute(
				"PUT /",
				Controller.UpdateUserNote,
				internalmiddleware.Validate(
					&UpdateUserNoteRequest{},
				),
			)
			m.RegisterExactRoute(
				"DELETE /",
				Controller.DeleteUserNote,
				internalmiddleware.Validate(
					&DeleteUserNoteRequest{},
				),
			)
			m.RegisterExactRoute(
				"GET /",
				Controller.GetUserNoteByID,
				internalmiddleware.Validate(
					&GetUserNoteByIDRequest{},
				),
			)
			m.RegisterExactRoute(
				"PUT /pin",
				Controller.UpdateUserNotePin,
				internalmiddleware.Validate(
					&UpdateUserNotePinRequest{},
				),
			)
			m.RegisterExactRoute(
				"PUT /archive",
				Controller.UpdateUserNoteArchive,
				internalmiddleware.Validate(
					&UpdateUserNoteArchiveRequest{},
				),
			)
			m.RegisterExactRoute(
				"PUT /trash",
				Controller.UpdateUserNoteTrash,
				internalmiddleware.Validate(
					&UpdateUserNoteTrashRequest{},
				),
			)
			m.RegisterExactRoute(
				"PUT /star",
				Controller.UpdateUserNoteStar,
				internalmiddleware.Validate(
					&UpdateUserNoteStarRequest{},
				),
			)
		},
	}
)

Functions

This section is empty.

Types

type CreateUserNoteRequest

type CreateUserNoteRequest struct {
	Title            string   `json:"title"`
	NoteTagsID       []string `json:"note_tags_id,omitempty"`
	Color            *string  `json:"color,omitempty"`
	Pinned           bool     `json:"pinned"`
	Archived         bool     `json:"archived"`
	Starred          bool     `json:"starred"`
	Trashed          bool     `json:"trashed"`
	EncryptedContent string   `json:"encrypted_content"`
}

CreateUserNoteRequest is the request DTO to create a user note

type DeleteUserNoteRequest

type DeleteUserNoteRequest struct {
	NoteID int64 `json:"note_id"`
}

DeleteUserNoteRequest is the request DTO to delete a user note

type GetUserNoteByIDRequest

type GetUserNoteByIDRequest struct {
	NoteID int64 `json:"note_id"`
}

GetUserNoteByIDRequest is the request DTO to get a user note by ID

type GetUserNoteByIDResponse

type GetUserNoteByIDResponse struct {
	Note internalpostgresmodel.UserNote `json:"note"`
}

GetUserNoteByIDResponse is the response DTO to get a user note by ID

type UpdateUserNoteArchiveRequest

type UpdateUserNoteArchiveRequest struct {
	NoteID  int64 `json:"note_id"`
	Archive bool  `json:"archive"`
}

UpdateUserNoteArchiveRequest is the request DTO to archive/unarchive a note

type UpdateUserNotePinRequest

type UpdateUserNotePinRequest struct {
	NoteID int64 `json:"note_id"`
	Pin    bool  `json:"pin"`
}

UpdateUserNotePinRequest is the request DTO to pin/unpin a note

type UpdateUserNoteRequest

type UpdateUserNoteRequest struct {
	NoteID int64   `json:"note_id"`
	Title  *string `json:"title,omitempty"`
	Color  *string `json:"color,omitempty"`
}

UpdateUserNoteRequest is the request DTO to update a user note

type UpdateUserNoteStarRequest

type UpdateUserNoteStarRequest struct {
	NoteID int64 `json:"note_id"`
	Star   bool  `json:"star"`
}

UpdateUserNoteStarRequest is the request DTO to star/unstar a note

type UpdateUserNoteTrashRequest

type UpdateUserNoteTrashRequest struct {
	NoteID int64 `json:"note_id"`
	Trash  bool  `json:"trash"`
}

UpdateUserNoteTrashRequest is the request DTO to trash/untrash a note

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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