feat: dtos for wishList service;

feat: validator for guid;
feat: created interface for wishlist service
This commit is contained in:
2025-08-06 17:36:31 +03:00
parent 6cb64d5f03
commit e4c879db36
4 changed files with 90 additions and 1 deletions

View File

@@ -0,0 +1,55 @@
// Copyright (c) 2025 Nikolai Papin
//
// This file is part of Easywish
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package dto
type WishListDto struct {
Guid string `json:"guid"`
Name string `json:"name"`
Hidden bool `json:"hidden"`
IconName string `json:"icon_name"`
Color string `json:"color"`
ColorGrad string `json:"color_grad"`
}
type NewWishListDto struct {
Name string `json:"name" binding:"required" validate:"max=32"`
Hidden bool `json:"hidden"`
IconName string `json:"icon_name" validate:"omitempty,max=64"`
Color string `json:"color" validate:"omitempty,color_hex"`
ColorGrad string `json:"color_grad" validate:"omitempty,color_hex"`
}
type WishDto struct {
Guid string `json:"guid"`
WishListGuid string `json:"wish_list_guid"`
Name string `json:"name"`
Description string `json:"description"`
PictureUrl string `json:"picture_url"`
Stars int `json:"stars"`
CreationDate int64 `json:"creation_date"`
Fulfilled bool `json:"fulfilled"`
FulfilledDate int64 `json:"fulfilled_date"`
}
type NewWishDto struct {
WishListGuid string `json:"wish_list_guid" binding:"required" validate:"guid"`
Name string `json:"name" binding:"required" validate:"max=64"`
Description string `json:"description" validate:"omitempty,max=1000"`
PictureUploadId string `json:"picture_upload_id" validate:"omitempty,upload_id=image"`
Stars int `json:"stars" validate:"min=1,max=5"`
}