diff --git a/.idea/.gitignore b/.idea/.gitignore index 73f69e0..1c2fda5 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -1,8 +1,8 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 30bab2a..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index f0bc489..68895b6 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -1,8 +1,8 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/.idea/niki.iml b/.idea/niki.iml deleted file mode 100644 index 7ee078d..0000000 --- a/.idea/niki.iml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/adapter/storage/action_piggy_bank.go b/adapter/storage/action_piggy_bank.go deleted file mode 100644 index 654b923..0000000 --- a/adapter/storage/action_piggy_bank.go +++ /dev/null @@ -1,23 +0,0 @@ -package storage - -import entitypiggybankrequest "git.gocasts.ir/ebhomengo/niki/entity/piggy_bank_request" - -func (d *DBMS) AddPiggyRequestBank([]entitypiggybankrequest.PiggyBankRequest) error { - return nil - -} -func (d *DBMS) EditPiggyRequestBank(PiggyRequestID uint, PiggyRequestBankInput entitypiggybankrequest.PiggyBankRequest) error { - return nil - -} -func (d *DBMS) DeletePiggyRequestBank(PiggyRequestID uint) error { - return nil - -} -func (d *DBMS) GetAllPiggyRequestBank() ([]entitypiggybankrequest.PiggyBankRequest, error) { - return []entitypiggybankrequest.PiggyBankRequest{}, nil - -} -func (d *DBMS) GetPiggyRequestBankByID(PiggyRequestBank uint) (entitypiggybankrequest.PiggyBankRequest, error) { - return entitypiggybankrequest.PiggyBankRequest{}, nil -} diff --git a/adapter/storage/action_piggy_bank_request.go b/adapter/storage/action_piggy_bank_request.go deleted file mode 100644 index 3305125..0000000 --- a/adapter/storage/action_piggy_bank_request.go +++ /dev/null @@ -1,30 +0,0 @@ -package storage - -import ( - storage "git.gocasts.ir/ebhomengo/niki/adapter/storage/models" - entitypiggybank "git.gocasts.ir/ebhomengo/niki/entity/piggy_bank" -) - -func (d *DBMS) AddPiggyBank([]entitypiggybank.PiggyBank) error { - return nil -} -func (d *DBMS) EditPiggyBank(piggyID uint, piggyBankInput entitypiggybank.PiggyBank) error { - return nil -} -func (d *DBMS) DeletePiggyBank(piggyID uint) error { - return nil -} -func (d *DBMS) GetAllPiggyBank() ([]entitypiggybank.PiggyBank, error) { - var storeResponse []storage.PiggyBank - if err := d.db.Find(&storeResponse).Error; err != nil { - return nil, err - } - actionsEntities := make([]entitypiggybank.PiggyBank, len(storeResponse)) - for i := range storeResponse { - actionsEntities[i] = storage.MapActionsStoreToEntity(storeResponse[i]) - } - return actionsEntities, nil -} -func (d *DBMS) GetPiggyBankByID(piggyBankID uint) (entitypiggybank.PiggyBank, error) { - return entitypiggybank.PiggyBank{}, nil -} diff --git a/adapter/storage/init.go b/adapter/storage/init.go deleted file mode 100644 index 0091ef4..0000000 --- a/adapter/storage/init.go +++ /dev/null @@ -1,22 +0,0 @@ -package storage - -import ( - "fmt" -) - -var DB DBMS - -func Init() { - var eErr error - //I. Define a data source name (DSN) - dsn := "niki_user:NIKI_user@123@tcp(127.0.0.1:3306)/niki?charset=utf8mb4&parseTime=True&loc=Local" - //II. Try to connect to dsn address - DB, eErr = GormConnect(dsn) - //III. If gorm connect successfully then try to migrate database - if eErr == nil { - err := GormAutoMigrate(*DB.db) - if err != nil { - fmt.Errorf("some error .... %#v", err) - } - } -} diff --git a/adapter/storage/models/actions.go b/adapter/storage/models/actions.go deleted file mode 100644 index 4b96eaf..0000000 --- a/adapter/storage/models/actions.go +++ /dev/null @@ -1,32 +0,0 @@ -package storage - -import ( - entitypiggybank "git.gocasts.ir/ebhomengo/niki/entity/piggy_bank" - "gorm.io/gorm" - "time" -) - -type PiggyBank struct { - gorm.Model - TotalAmount uint - SerialNumber string - //to don't insert value in "updated_at" at "insert mode" : - //see more: https://gorm.io/docs/update.html - UpdatedAt *time.Time `json:"updated_at" gorm:"<-:update"` -} - -func MapActionsStoreToEntity(piggyBank PiggyBank) entitypiggybank.PiggyBank { - returnModel := entitypiggybank.PiggyBank{ - ID: piggyBank.ID, - SerialNumber: piggyBank.SerialNumber, - TotalAmount: piggyBank.TotalAmount, - } - return returnModel -} - -func MapEntityToActionsStore(input entitypiggybank.PiggyBank) PiggyBank { - return PiggyBank{ - SerialNumber: input.SerialNumber, - TotalAmount: input.TotalAmount, - } -} diff --git a/adapter/storage/setup.go b/adapter/storage/setup.go deleted file mode 100644 index 3dec335..0000000 --- a/adapter/storage/setup.go +++ /dev/null @@ -1,33 +0,0 @@ -package storage - -import ( - storage "git.gocasts.ir/ebhomengo/niki/adapter/storage/models" - "gorm.io/driver/mysql" - "gorm.io/gorm" - "gorm.io/gorm/logger" -) - -type DBMS struct { - db *gorm.DB -} - -func GormConnect(dsn string) (DBMS, error) { - gorm, err := gorm.Open(mysql.Open(dsn), &gorm.Config{ - Logger: logger.Default.LogMode(logger.Info), - }) - if err != nil { - return DBMS{}, err - } - return DBMS{db: gorm}, nil -} - -func GormAutoMigrate(db gorm.DB) error { - // Migrate the schema - err := db.AutoMigrate( - storage.PiggyBank{}, - ) - if err != nil { - panic(any("Storage auto migrate has error")) - } - return err -} diff --git a/config/config.go b/config/config.go new file mode 100644 index 0000000..8349495 --- /dev/null +++ b/config/config.go @@ -0,0 +1,14 @@ +package config + +import ( + "git.gocasts.ir/ebhomengo/niki/repository/mysql" +) + +type HTTPServer struct { + Port int `koanf:"port"` +} + +type Config struct { + HTTPServer HTTPServer `koanf:"http_server"` + Mysql mysql.Config `koanf:"mysql"` +} diff --git a/delivery/http/V1/init.go b/delivery/http/V1/init.go deleted file mode 100644 index 1eda484..0000000 --- a/delivery/http/V1/init.go +++ /dev/null @@ -1,12 +0,0 @@ -package V1 - -import ( - deliverypiggybank "git.gocasts.ir/ebhomengo/niki/delivery/http/V1/piggy_bank" - "github.com/labstack/echo/v4" -) - -func Init(echo *echo.Echo) { - - deliverypiggybank.Routs(echo) - -} diff --git a/delivery/http/V1/piggy_bank/edit.go b/delivery/http/V1/piggy_bank/edit.go deleted file mode 100644 index 6b35b48..0000000 --- a/delivery/http/V1/piggy_bank/edit.go +++ /dev/null @@ -1,12 +0,0 @@ -package deliverypiggybank - -import ( - "github.com/labstack/echo/v4" - "net/http" -) - -func EditPiggyBank() echo.HandlerFunc { - return func(c echo.Context) error { - return c.JSON(http.StatusOK, nil) - } -} diff --git a/delivery/http/V1/piggy_bank/init.go b/delivery/http/V1/piggy_bank/init.go deleted file mode 100644 index e9f4bac..0000000 --- a/delivery/http/V1/piggy_bank/init.go +++ /dev/null @@ -1,8 +0,0 @@ -package deliverypiggybank - -import "github.com/labstack/echo/v4" - -func Routs(e *echo.Echo) { - //initialise piggy_bank details routes - -} diff --git a/delivery/http/V1/piggy_bank/new.go b/delivery/http/V1/piggy_bank/new.go deleted file mode 100644 index ff3cde0..0000000 --- a/delivery/http/V1/piggy_bank/new.go +++ /dev/null @@ -1,13 +0,0 @@ -package deliverypiggybank - -import ( - "github.com/labstack/echo/v4" - "net/http" -) - -func NewPiggyBank() echo.HandlerFunc { - return func(c echo.Context) error { - - return c.JSON(http.StatusCreated, "") - } -} diff --git a/delivery/http/init.go b/delivery/http/init.go deleted file mode 100644 index 6df267f..0000000 --- a/delivery/http/init.go +++ /dev/null @@ -1,20 +0,0 @@ -package http - -import ( - "git.gocasts.ir/ebhomengo/niki/delivery/http/V1" - "github.com/labstack/echo/v4" - "github.com/labstack/echo/v4/middleware" -) - -func Init() { - //initialise new Echo (web framework) - e := echo.New() - e.Use(middleware.CORSWithConfig(middleware.CORSConfig{ - AllowOrigins: []string{"*" /*, "https://labstack.net"*/}, - AllowHeaders: []string{echo.HeaderOrigin, echo.HeaderContentType, echo.HeaderAccept}, - })) - //handle incoming requests: - V1.Init(e) - //serve with port - e.Logger.Fatal(e.Start(":1313")) -} diff --git a/delivery/httpserver/server.go b/delivery/httpserver/server.go new file mode 100644 index 0000000..5a120cb --- /dev/null +++ b/delivery/httpserver/server.go @@ -0,0 +1,17 @@ +package httpserver + +import "git.gocasts.ir/ebhomengo/niki/config" + +type Server struct { + config config.Config +} + +func New(config config.Config) Server { + return Server{ + config: config, + } +} + +func (s Server) Serve() { + +} diff --git a/dto/piggy_bank/piggy_bank.go b/dto/piggy_bank/piggy_bank.go deleted file mode 100644 index 648e31c..0000000 --- a/dto/piggy_bank/piggy_bank.go +++ /dev/null @@ -1,17 +0,0 @@ -package dto - -import ( - entitypiggybank "git.gocasts.ir/ebhomengo/niki/entity/piggy_bank" -) - -type ( - //get - GetPiggyBankRequest struct { - ID uint `json:"id"` - TotalAmount uint `json:"totalAmount"` - SerialNumber string `json:"serialNumber"` - } - GetPiggyBankResponse struct { - Games []entitypiggybank.PiggyBank - } -) diff --git a/entity/piggy_bank.go b/entity/piggy_bank.go new file mode 100644 index 0000000..7cd6eab --- /dev/null +++ b/entity/piggy_bank.go @@ -0,0 +1,11 @@ +package entity + +import "time" + +type PiggyBank struct { + ID uint + TotalAmount uint + SerialNumber string + Status uint + StatusChangedAt *time.Time +} diff --git a/entity/piggy_bank/contract.go b/entity/piggy_bank/contract.go deleted file mode 100644 index 9ab4c07..0000000 --- a/entity/piggy_bank/contract.go +++ /dev/null @@ -1,9 +0,0 @@ -package entitypiggybank - -type PiggyBankServices interface { - AddPiggyBank([]PiggyBank) error - EditPiggyBank(piggyID uint, piggyBankInput PiggyBank) error - DeletePiggyBank(piggyID uint) error - GetAllPiggyBank() ([]PiggyBank, error) - GetPiggyBankByID(piggyBankID uint) (PiggyBank, error) -} diff --git a/entity/piggy_bank/model.go b/entity/piggy_bank/model.go deleted file mode 100644 index 335d391..0000000 --- a/entity/piggy_bank/model.go +++ /dev/null @@ -1,9 +0,0 @@ -package entitypiggybank - -type ( - PiggyBank struct { - ID uint - TotalAmount uint - SerialNumber string - } -) diff --git a/entity/piggy_bank_request/contract.go b/entity/piggy_bank_request/contract.go deleted file mode 100644 index 6edad4b..0000000 --- a/entity/piggy_bank_request/contract.go +++ /dev/null @@ -1,9 +0,0 @@ -package entitypiggybankrequest - -type PiggyRequestBankRequestServices interface { - AddPiggyRequestBank([]PiggyBankRequest) error - EditPiggyRequestBank(PiggyRequestID uint, PiggyRequestBankInput PiggyBankRequest) error - DeletePiggyRequestBank(PiggyRequestID uint) error - GetAllPiggyRequestBank() ([]PiggyBankRequest, error) - GetPiggyRequestBankByID(PiggyRequestBank uint) (PiggyBankRequest, error) -} diff --git a/entity/piggy_bank_request/model.go b/entity/piggy_bank_request/model.go deleted file mode 100644 index fc6e7d7..0000000 --- a/entity/piggy_bank_request/model.go +++ /dev/null @@ -1,12 +0,0 @@ -package entitypiggybankrequest - -type ( - PiggyBankRequest struct { - ID uint - TypeId uint - CountRequested uint - CountAccepted uint - BenefactorID uint - Description string - } -) diff --git a/go.mod b/go.mod index 0f16f59..ea6120e 100644 --- a/go.mod +++ b/go.mod @@ -1,26 +1,3 @@ module git.gocasts.ir/ebhomengo/niki -go 1.21.0 - -require ( - github.com/labstack/echo/v4 v4.11.3 - gorm.io/driver/mysql v1.5.2 - gorm.io/gorm v1.25.5 -) - -require ( - github.com/go-sql-driver/mysql v1.7.0 // indirect - github.com/golang-jwt/jwt v3.2.2+incompatible // indirect - github.com/jinzhu/inflection v1.0.0 // indirect - github.com/jinzhu/now v1.1.5 // indirect - github.com/labstack/gommon v0.4.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect - github.com/valyala/bytebufferpool v1.0.0 // indirect - github.com/valyala/fasttemplate v1.2.2 // indirect - golang.org/x/crypto v0.14.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - golang.org/x/time v0.3.0 // indirect -) +go 1.21.3 diff --git a/main.go b/main.go index 07b7901..7905807 100644 --- a/main.go +++ b/main.go @@ -1,13 +1,5 @@ -package niki - -import ( - "git.gocasts.ir/ebhomengo/niki/adapter/storage" - "git.gocasts.ir/ebhomengo/niki/delivery/http" -) +package main func main() { - //initialize D.B.M.S. (Database management system) - storage.Init() - //initialize new Echo (web framework) - http.Init() + } diff --git a/param/piggy_bank_delete.go b/param/piggy_bank_delete.go new file mode 100644 index 0000000..e98f3a4 --- /dev/null +++ b/param/piggy_bank_delete.go @@ -0,0 +1,7 @@ +package param + +type PiggyBankDeleteRequest struct { +} + +type PiggyBankDeleteResponse struct { +} diff --git a/param/piggy_bank_get_all.go b/param/piggy_bank_get_all.go new file mode 100644 index 0000000..0316933 --- /dev/null +++ b/param/piggy_bank_get_all.go @@ -0,0 +1,7 @@ +package param + +type PiggyBankGetAllRequest struct { +} + +type PiggyBankGetAllResponse struct { +} diff --git a/param/piggy_bank_get_by_id.go b/param/piggy_bank_get_by_id.go new file mode 100644 index 0000000..fd00b67 --- /dev/null +++ b/param/piggy_bank_get_by_id.go @@ -0,0 +1,7 @@ +package param + +type PiggyBankGetByIdRequest struct { +} + +type PiggyBankGetByIdResponse struct { +} diff --git a/param/piggy_bank_store.go b/param/piggy_bank_store.go new file mode 100644 index 0000000..87a1e7f --- /dev/null +++ b/param/piggy_bank_store.go @@ -0,0 +1,7 @@ +package param + +type PiggyBankStoreRequest struct { +} + +type PiggyBankStoreResponse struct { +} diff --git a/param/piggy_bank_update.go b/param/piggy_bank_update.go new file mode 100644 index 0000000..226e0a8 --- /dev/null +++ b/param/piggy_bank_update.go @@ -0,0 +1,7 @@ +package param + +type PiggyBankUpdateRequest struct { +} + +type PiggyBankUpdateResponse struct { +} diff --git a/repository/mysql/db.go b/repository/mysql/db.go new file mode 100644 index 0000000..4d3dd62 --- /dev/null +++ b/repository/mysql/db.go @@ -0,0 +1,42 @@ +package mysql + +import ( + "database/sql" + "fmt" + "time" +) + +type Config struct { + Username string `koanf:"username"` + Password string `koanf:"password"` + Port int `koanf:"port"` + Host string `koanf:"host"` + DBName string `koanf:"db_name"` +} + +type MySQLDB struct { + config Config + db *sql.DB +} + +func (m *MySQLDB) Conn() *sql.DB { + return m.db +} + +func New(config Config) *MySQLDB { + // parseTime=true changes the output type of DATE and DATETIME values to time.Time + // instead of []byte / string + // The date or datetime like 0000-00-00 00:00:00 is converted into zero value of time.Time + db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@(%s:%d)/%s?parseTime=true", + config.Username, config.Password, config.Host, config.Port, config.DBName)) + if err != nil { + panic(fmt.Errorf("can't open mysql db: %v", err)) + } + + // See "Important settings" section. + db.SetConnMaxLifetime(time.Minute * 3) + db.SetMaxOpenConns(10) + db.SetMaxIdleConns(10) + + return &MySQLDB{config: config, db: db} +} diff --git a/repository/mysql/dbconfig.yml b/repository/mysql/dbconfig.yml new file mode 100644 index 0000000..e69de29 diff --git a/repository/mysql/mysqlpiggybank/db.go b/repository/mysql/mysqlpiggybank/db.go new file mode 100644 index 0000000..2e7040a --- /dev/null +++ b/repository/mysql/mysqlpiggybank/db.go @@ -0,0 +1,13 @@ +package mysqlpiggybank + +import "git.gocasts.ir/ebhomengo/niki/repository/mysql" + +type DB struct { + conn *mysql.MySQLDB +} + +func New(conn *mysql.MySQLDB) *DB { + return &DB{ + conn: conn, + } +} diff --git a/repository/mysql/mysqlpiggybank/piggy_bank.go b/repository/mysql/mysqlpiggybank/piggy_bank.go new file mode 100644 index 0000000..d9fa118 --- /dev/null +++ b/repository/mysql/mysqlpiggybank/piggy_bank.go @@ -0,0 +1 @@ +package mysqlpiggybank diff --git a/service/piggy_bank/edit.go b/service/piggy_bank/edit.go deleted file mode 100644 index 10d4e4a..0000000 --- a/service/piggy_bank/edit.go +++ /dev/null @@ -1,11 +0,0 @@ -package piggy_bank - -import ( - dto "git.gocasts.ir/ebhomengo/niki/dto/piggy_bank" -) - -func (uc Usecase) EditPiggyBank(req dto.GetPiggyBankRequest) error { - //validation DTO request - - return nil -} diff --git a/service/piggy_bank/init.go b/service/piggy_bank/init.go deleted file mode 100644 index 7e90d23..0000000 --- a/service/piggy_bank/init.go +++ /dev/null @@ -1,14 +0,0 @@ -package piggy_bank - -import ( - "git.gocasts.ir/ebhomengo/niki/adapter/storage" - entitypiggybank "git.gocasts.ir/ebhomengo/niki/entity/piggy_bank" -) - -type Usecase struct { - storage entitypiggybank.PiggyBankServices -} - -func InitUsecase() Usecase { - return Usecase{storage: &storage.DB} -} diff --git a/service/piggy_bank/new.go b/service/piggy_bank/new.go deleted file mode 100644 index 420954e..0000000 --- a/service/piggy_bank/new.go +++ /dev/null @@ -1,11 +0,0 @@ -package piggy_bank - -import ( - dto "git.gocasts.ir/ebhomengo/niki/dto/piggy_bank" -) - -func (uc Usecase) NewPiggyBank(req dto.GetPiggyBankRequest) error { - //validation DTO request - - return nil -} diff --git a/service/piggybankservice/delete.go b/service/piggybankservice/delete.go new file mode 100644 index 0000000..018cb51 --- /dev/null +++ b/service/piggybankservice/delete.go @@ -0,0 +1,7 @@ +package piggybankservice + +import "git.gocasts.ir/ebhomengo/niki/param" + +func (s Service) Delete(req param.PiggyBankDeleteRequest) (param.PiggyBankDeleteResponse, error) { + return param.PiggyBankDeleteResponse{}, nil +} diff --git a/service/piggybankservice/get_all.go b/service/piggybankservice/get_all.go new file mode 100644 index 0000000..22815a5 --- /dev/null +++ b/service/piggybankservice/get_all.go @@ -0,0 +1,7 @@ +package piggybankservice + +import "git.gocasts.ir/ebhomengo/niki/param" + +func (s Service) GetAll(req param.PiggyBankGetAllRequest) (param.PiggyBankGetAllResponse, error) { + return param.PiggyBankGetAllResponse{}, nil +} diff --git a/service/piggybankservice/get_by_id.go b/service/piggybankservice/get_by_id.go new file mode 100644 index 0000000..a61326b --- /dev/null +++ b/service/piggybankservice/get_by_id.go @@ -0,0 +1,7 @@ +package piggybankservice + +import "git.gocasts.ir/ebhomengo/niki/param" + +func (s Service) GetById(req param.PiggyBankGetByIdRequest) (param.PiggyBankGetByIdResponse, error) { + return param.PiggyBankGetByIdResponse{}, nil +} diff --git a/service/piggybankservice/service.go b/service/piggybankservice/service.go new file mode 100644 index 0000000..eacf98c --- /dev/null +++ b/service/piggybankservice/service.go @@ -0,0 +1,21 @@ +package piggybankservice + +import "git.gocasts.ir/ebhomengo/niki/entity" + +type Repository interface { + AddPiggyBank(piggy entity.PiggyBank) (entity.PiggyBank, error) + EditPiggyBank(piggyID uint, piggyBankInput entity.PiggyBank) (entity.PiggyBank, error) + DeletePiggyBank(piggyID uint) error + GetAllPiggyBank() ([]entity.PiggyBank, error) + GetPiggyBankByID(piggyBank uint) (entity.PiggyBank, error) +} + +type Service struct { + repo Repository +} + +func New(repository Repository) Service { + return Service{ + repo: repository, + } +} diff --git a/service/piggybankservice/store.go b/service/piggybankservice/store.go new file mode 100644 index 0000000..770e407 --- /dev/null +++ b/service/piggybankservice/store.go @@ -0,0 +1,7 @@ +package piggybankservice + +import "git.gocasts.ir/ebhomengo/niki/param" + +func (s Service) Store(req param.PiggyBankStoreRequest) (param.PiggyBankStoreResponse, error) { + return param.PiggyBankStoreResponse{}, nil +} diff --git a/service/piggybankservice/update.go b/service/piggybankservice/update.go new file mode 100644 index 0000000..720a1b0 --- /dev/null +++ b/service/piggybankservice/update.go @@ -0,0 +1,7 @@ +package piggybankservice + +import "git.gocasts.ir/ebhomengo/niki/param" + +func (s Service) Update(req param.PiggyBankUpdateRequest) (param.PiggyBankUpdateResponse, error) { + return param.PiggyBankUpdateResponse{}, nil +} diff --git a/validator/piggybankvalidator/delete.go b/validator/piggybankvalidator/delete.go new file mode 100644 index 0000000..4f4ad52 --- /dev/null +++ b/validator/piggybankvalidator/delete.go @@ -0,0 +1,7 @@ +package piggybankvalidator + +import "git.gocasts.ir/ebhomengo/niki/param" + +func (v Validator) ValidateDeleteRequest(req param.PiggyBankDeleteRequest) { + +} diff --git a/validator/piggybankvalidator/get_by_id.go b/validator/piggybankvalidator/get_by_id.go new file mode 100644 index 0000000..9dd4122 --- /dev/null +++ b/validator/piggybankvalidator/get_by_id.go @@ -0,0 +1,7 @@ +package piggybankvalidator + +import "git.gocasts.ir/ebhomengo/niki/param" + +func (v Validator) ValidateGetByIdRequest(req param.PiggyBankGetByIdRequest) { + +} diff --git a/validator/piggybankvalidator/store.go b/validator/piggybankvalidator/store.go new file mode 100644 index 0000000..15fa4b9 --- /dev/null +++ b/validator/piggybankvalidator/store.go @@ -0,0 +1,7 @@ +package piggybankvalidator + +import "git.gocasts.ir/ebhomengo/niki/param" + +func (v Validator) ValidateStoreRequest(req param.PiggyBankStoreRequest) { + +} diff --git a/validator/piggybankvalidator/update.go b/validator/piggybankvalidator/update.go new file mode 100644 index 0000000..15c4dd6 --- /dev/null +++ b/validator/piggybankvalidator/update.go @@ -0,0 +1,7 @@ +package piggybankvalidator + +import "git.gocasts.ir/ebhomengo/niki/param" + +func (v Validator) ValidateUpdateRequest(req param.PiggyBankUpdateRequest) { + +} diff --git a/validator/piggybankvalidator/validator.go b/validator/piggybankvalidator/validator.go new file mode 100644 index 0000000..3e7ea90 --- /dev/null +++ b/validator/piggybankvalidator/validator.go @@ -0,0 +1,12 @@ +package piggybankvalidator + +type Repository interface { +} + +type Validator struct { + repo Repository +} + +func New(repo Repository) Validator { + return Validator{repo: repo} +}