package
0.0.0-20240114183636-976fe976a834
Repository: https://github.com/akshachrd/leards-backend-go.git
Documentation: pkg.go.dev

# Functions

AddStorageToFavorite godoc @Id addStorageToFavorite @Summary add favorite storage by user id, storage id and storage type @Description creates a new favorite storage in the database @Tags library @Accept json @Produce json @Security BearerAuth @Param user_id path string true "User ID" minlength(36) maxlength(36) @Param storage_type path string true "Storage type" Enums(deck, folder) @Param storage_id path string true "Storage ID" minlength(36) maxlength(36) @Success 201 {object} httputils.BasicResponse @Failure 500 {object} httputils.HTTPError @Router /library/{user_id}/{storage_type}/{storage_id} [post].
AddTagsToStorage godoc @Id addTagsToStorage @Summary Add tags to the storage @Description creates new tags or takes ones that already exist and links them in the database @Tags tags @Accept json @Produce json @Security Bearer @Param user_id path string true "User ID" minlength(36) maxlength(36) @Param storage_type path string true "Storage type" Enums(deck, folder) @Param storage_id path string true "Storage ID" minlength(36) maxlength(36) @Param addTagsToStorageData body httputils.TagsRequest true "Add tags to storage data" @Success 200 {object} httputils.BasicResponse @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /tags/{user_id}/{storage_type}/{storage_id} [post].
CloneDeck godoc @Id cloneDeckById @Summary Clones the deck by id @Description clones the deck in the database @Tags decks @Accept json @Produce json @Security Bearer @Param cloneDeckData body httputils.CloneDeckRequest true "Clone deck data" @Success 200 {object} httputils.DeckResponse @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /decks/clone [post].
CreateDeck godoc @Id createNewDeck @Summary Create a new deck @Description creates a new deck in the database @Tags decks @Accept json @Produce json @Security Bearer @Param createDeckData body httputils.CreateDeckRequest true "Create deck data" @Success 200 {object} httputils.DeckResponse @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /decks [post].
CreateFolder godoc @Id createNewFolder @Summary Create a new folder @Description creates a new folder in the database @Tags folders @Accept json @Produce json @Security Bearer @Param createFolderData body httputils.CreateFolderRequest true "Create folder data" @Success 201 {object} httputils.FolderResponse @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /folders [post].
CreateUser godoc @Id registerNewUser @Summary Register a new user @Description creates a new user and returns a token @Tags accounts @Accept json @Produce json @Param createUserData body httputils.CreateUserRequest true "User register data" @Success 201 {object} httputils.UserResponse @Failure 400 {object} httputils.HTTPError @Failure 404 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /accounts [post].
DeleteDeck godoc @Id deleteDeckById @Summary Delete the deck by id @Description deletes the deck in the database @Tags decks @Accept json @Produce json @Security Bearer @Param deck_id path string true "Deck ID" @Success 200 {object} httputils.BasicResponse @Failure 400 {object} httputils.HTTPError @Router /decks/{deck_id} [delete].
DeleteFolder godoc @Id deleteFolderById @Summary Delete the folder by id @Description deletes the folder in the database @Tags folders @Accept json @Produce json @Security Bearer @Param folder_id path string true "Folder ID" @Success 200 {object} httputils.BasicResponse @Failure 400 {object} httputils.HTTPError @Router /folders/{folder_id} [delete].
GetAvatar godoc @Id getAvatarByUserId @Summary get avatar by user id @Description returns the user's avatar @Tags accounts @Accept json @Produce png @Produce images/jpg @Produce jpeg @Produce gif @Param user_id path string true "User ID" @Success 200 {file} file @Failure 400 {object} httputils.HTTPError @Failure 404 {object} httputils.HTTPError @Router /accounts/{user_id}/avatar [get].
GetDeck godoc @Id getDeckById @Summary Get the deck by id @Description fetches the deck from the database @Tags decks @Accept json @Produce json @Security Bearer @Param deck_id path string true "Deck ID" @Success 200 {object} httputils.DeckResponse @Failure 400 {object} httputils.HTTPError @Router /decks/{deck_id} [get].
GetDeckSettings godoc @Id getDeckSettingsByDeckId @Summary Get the deck's settings by deck id @Description fetches the deck from the database and returns settings @Tags decks @Accept json @Produce json @Security Bearer @Param deck_id path string true "Deck ID" @Success 200 {object} httputils.StorageSettingsResponse @Failure 400 {object} httputils.HTTPError @Router /decks/{deck_id}/settings [get].
GetFavoriteStorages godoc @Id getFavoriteStorages @Summary get favorite storages by user id @Description returns the user's favorite storages @Tags library @Accept json @Produce json @Security BearerAuth @Param user_id path string true "User ID" @Success 200 {object} httputils.FavoriteStoragesResponse @Failure 500 {object} httputils.HTTPError @Router /library/{user_id} [get].
GetFolder godoc @Id getFolderById @Summary Get the folder by id @Description fetches the folder from the database @Tags folders @Accept json @Produce json @Security Bearer @Param folder_id path string true "Folder ID" @Success 200 {object} httputils.FolderResponse @Failure 400 {object} httputils.HTTPError @Router /folders/{folder_id} [get].
GetFolderSettings godoc @Id getFolderSettingsByFolderId @Summary Get the folder's settings by folder id @Description fetches the folder from the database and returns settings @Tags folders @Accept json @Produce json @Security Bearer @Param folder_id path string true "Folder ID" @Success 200 {object} httputils.StorageSettingsResponse @Failure 400 {object} httputils.HTTPError @Router /folders/{folder_id}/settings [get].
GetNextCard godoc @Id getNextCard @Summary Get next card for repetition @Description fetches next card for repetition from the database @Tags repetition @Accept json @Produce json @Security Bearer @Param user_id query string true "User ID" @Param storage_type path string true "Storage type" Enums(deck, folder) @Param storage_id path string true "Storage ID" minlength(36) maxlength(36) @Success 200 {object} httputils.Card @Failure 500 {object} httputils.HTTPError @Router /repetition/{storage_type}/{storage_id} [get].
GetStorageCards godoc @Id getStorageCards @Summary Get all storage's cards @Description fetches cards of the storage from the database @Tags cards @Accept json @Produce json @Security Bearer @Param storage_type path string true "Storage type" Enums(deck, folder) @Param storage_id path string true "Storage ID" minlength(36) maxlength(36) @Success 200 {object} httputils.CardsResponse @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /cards/{storage_type}/{storage_id} [get].
GetStorageStats godoc @Id getStorageStats @Summary Get stats of a storage after repetition @Description fetches stats of storage after repetition from the database @Tags repetition @Accept json @Produce json @Security Bearer @Param user_id query string true "User ID" @Param storage_type path string true "Storage type" Enums(deck, folder) @Param storage_id path string true "Storage ID" minlength(36) maxlength(36) @Success 200 {object} httputils.RepetitionStats @Failure 500 {object} httputils.HTTPError @Router /repetition/{storage_type}/{storage_id}/stats [get].
GetUserSettings godoc @Id getUserSettings @Summary Get the user settings @Description fetches the user settings from the database @Tags userSettings @Accept json @Produce json @Security Bearer @Param user_id path string true "User ID" @Success 200 {object} httputils.UserSettingsResponse @Failure 400 {object} httputils.HTTPError @Router /accounts/{user_id}/settings [get].
LoginUser godoc @Id loginUser @Summary Login the user @Description returns the user @Tags accounts @Accept json @Produce json @Security BasicAuth @Success 201 {object} httputils.UserResponse @Failure 400 {object} httputils.HTTPError @Failure 401 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /accounts [get].
RefreshToken godoc @Id refreshToken @Summary Refresh user's token @Description when token is expired you need to refresh it @Tags auth @Accept json @Produce json @Security Bearer @Param user_id path string true "User ID" @Success 200 {object} httputils.TokenResponse @Failure 400 {object} httputils.HTTPError @Failure 403 {object} httputils.HTTPError @Failure 404 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /auth/{user_id} [get].
RemoveAvatar godoc @Id removeAvatarByUserId @Summary remove avatar by user id @Description removes the user's avatar @Tags accounts @Produce json @Security BearerAuth @Param user_id path string true "User ID" @Success 200 {object} httputils.BasicResponse @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /accounts/{user_id}/avatar [delete].
RemoveStorageFromFavorite godoc @Id removeStorageFromFavorite @Summary remove the storage from favorites by user id, storage id and storage type @Description deletes the favorite storage in the database @Tags library @Accept json @Produce json @Security BearerAuth @Param user_id path string true "User ID" minlength(36) maxlength(36) @Param storage_type path string true "Storage type" Enums(deck, folder) @Param storage_id path string true "Storage ID" minlength(36) maxlength(36) @Success 201 {object} httputils.BasicResponse @Failure 500 {object} httputils.HTTPError @Router /library/{user_id}/{storage_type}/{storage_id} [delete].
RemoveTagsFromStorage godoc @Id removeTagsFromStorage @Summary removes tags from the storage @Description deletes tags and unlink them from storage in the database @Tags tags @Accept json @Produce json @Security Bearer @Param user_id path string true "User ID" minlength(36) maxlength(36) @Param storage_type path string true "Storage type" Enums(deck, folder) @Param storage_id path string true "Storage ID" minlength(36) maxlength(36) @Param removeTagsToStorageData body httputils.TagsRequest true "Remove tags to storage data" @Success 200 {object} httputils.BasicResponse @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /tags/{user_id}/{storage_type}/{storage_id} [delete].
ReviewCard godoc @Id reviewCard @Summary Review card @Description reviews card and updates repetition in the database @Tags repetition @Accept json @Produce json @Security Bearer @Param reviewCardRequest body httputils.ReviewCardRequest true "Review card data" @Success 200 {array} services.SearchResult @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /repetition [put].
RevokeToken godoc @Id revokeToken @Summary Revokes user's token @Description when user signs out token needs to be revoked @Tags auth @Accept json @Produce json @Security Bearer @Param user_id path string true "User ID" @Success 200 {object} httputils.BasicResponse @Failure 401 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /auth/{user_id} [delete].
SearchPublicStorages godoc @Id searchPublicStorages @Summary Get public storages with search @Description fetches public storages from the database @Tags search @Accept json @Produce json @Security Bearer @Param page query int false "Page" minimum(1) @Param page_size query int false "Page size" minimum(10) maximum(100) @Param search_type query string true "Search type" Enums(all, tag, name) @Param sort_type query string true "Sort type" Enums(rating, name) @Param order_by query string true "Order by" Enums(asc, desc) @Param name query string false "Name" @Param tags query []string false "Tags" collectionFormat(multi) @Success 200 {array} httputils.SearchResult @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /search [get].
SetStorageAccess godoc @Id setStorageAccess @Summary Set the storage's access type @Description sets the storage's access type in the database @Tags sharing @Accept json @Produce json @Security Bearer @Param storage_type path string true "Storage type" Enums(deck, folder) @Param storage_id path string true "Storage ID" minlength(36) maxlength(36) @Param SetStorageAccessData body httputils.SetStorageAccessRequest true "Set storage access data" @Success 200 {object} httputils.BasicResponse @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /sharing/{storage_type}/{storage_id} [put].
SyncCards godoc @Id syncCardsByDeckId @Summary Synchronizes cards @Description adds card without id, updates card with id, deletes card if it's not presented inside the request @Tags cards @Accept json @Produce json @Security Bearer @Param deck_id path string true "Deck ID" @Param syncCardsRequest body httputils.SyncCardsRequest true "Sync cards data" @Success 200 {object} httputils.BasicResponse @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /cards/deck/{deck_id} [put].
UpdateDeck godoc @Id updateDeckById @Summary Updates the deck by id @Description updates the deck in the database @Tags decks @Accept json @Produce json @Security Bearer @Param deck_id path string true "Deck ID" @Param updateDeckData body httputils.UpdateDeckRequest true "Update deck data" @Success 200 {object} httputils.DeckResponse @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /decks/{deck_id} [put].
UpdateFolder godoc @Id updateFolderById @Summary Update the folder by id @Description updates the folder in the database @Tags folders @Accept json @Produce json @Security Bearer @Param folder_id path string true "Folder ID" @Param updateFolderData body httputils.UpdateFolderRequest true "Update folder data" @Success 200 {object} httputils.FolderResponse @Failure 400 {object} httputils.HTTPError @Router /folders/{folder_id} [put].
UpdateUser godoc @Id UpdateUser @Summary Updates the user by id @Description updates the user in the database @Tags accounts @Accept json @Produce json @Security BearerAuth @Param user_id path string true "User ID" @Param updateUserData body httputils.UpdateUserRequest true "Update user data" @Success 200 {object} httputils.UserResponse @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /accounts/{user_id} [put].
UpdateUserSettings godoc @Id updateUserSettings @Summary Update the user settings @Description updates the user settings in the database @Tags userSettings @Accept json @Produce json @Security Bearer @Param user_id path string true "User ID" @Param updateUserSettingsData body httputils.UpdateUserSettingsRequest true "Update user settings data" @Success 200 {object} httputils.UserSettingsResponse @Failure 400 {object} httputils.HTTPError @Router /accounts/{user_id}/settings [put].
UploadAvatar godoc @Id uploadAvatarByUserId @Summary upload avatar by user id @Description updates the user's avatar @Tags accounts @Accept multipart/form-data @Produce json @Security BearerAuth @Param user_id path string true "User ID" @Param avatar formData file true "Avatar image file (JPG, JPEG, PNG, or GIF)" @Success 200 {object} httputils.UpdateAvatarResponse @Failure 400 {object} httputils.HTTPError @Failure 500 {object} httputils.HTTPError @Router /accounts/{user_id}/avatar [put].