From 760a9821c52e4a336266ed070fc13611bfbc8595 Mon Sep 17 00:00:00 2001 From: HQ2-AlirezaMokhtariG Date: Fri, 15 Dec 2023 11:54:06 +0330 Subject: [PATCH] piggy_bank entity added --- .idea/.gitignore | 8 ++++++++ .idea/misc.xml | 7 +++++++ .idea/modules.xml | 8 ++++++++ .idea/niki.iml | 9 +++++++++ .idea/vcs.xml | 6 ++++++ .../contract/piggy_bank_request_service.go | 13 +++++++++++++ entity/piggy_bank/contract/piggy_bank_service.go | 11 +++++++++++ entity/piggy_bank/model/piggy_bank.go | 13 +++++++++++++ entity/piggy_bank/model/piggy_bank_request.go | 12 ++++++++++++ go.mod | 3 +++ main.go | 5 +++++ service/piggy_bank/init.go | 3 +++ 12 files changed, 98 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/niki.iml create mode 100644 .idea/vcs.xml create mode 100644 entity/piggy_bank/contract/piggy_bank_request_service.go create mode 100644 entity/piggy_bank/contract/piggy_bank_service.go create mode 100644 entity/piggy_bank/model/piggy_bank.go create mode 100644 entity/piggy_bank/model/piggy_bank_request.go create mode 100644 go.mod create mode 100644 main.go create mode 100644 service/piggy_bank/init.go diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..30bab2a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f0bc489 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/niki.iml b/.idea/niki.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/.idea/niki.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/entity/piggy_bank/contract/piggy_bank_request_service.go b/entity/piggy_bank/contract/piggy_bank_request_service.go new file mode 100644 index 0000000..194d02a --- /dev/null +++ b/entity/piggy_bank/contract/piggy_bank_request_service.go @@ -0,0 +1,13 @@ +package contract + +import ( + entityppigybank "niki/entity/piggy_bank/model" +) + +type PiggyRequestBankRequestServices interface { + AddPiggyRequestBank([]entityppigybank.PiggyBankRequest) error + EditPiggyRequestBank(PiggyRequestID uint, PiggyRequestBankInput entityppigybank.PiggyBankRequest) error + DeletePiggyRequestBank(PiggyRequestID uint) error + GetAllPiggyRequestBank() ([]entityppigybank.PiggyBankRequest, error) + GetPiggyRequestBankByID(PiggyRequestBank uint) (entityppigybank.PiggyBankRequest, error) +} diff --git a/entity/piggy_bank/contract/piggy_bank_service.go b/entity/piggy_bank/contract/piggy_bank_service.go new file mode 100644 index 0000000..236f9e8 --- /dev/null +++ b/entity/piggy_bank/contract/piggy_bank_service.go @@ -0,0 +1,11 @@ +package contract + +import entityppigybank "niki/entity/piggy_bank/model" + +type PiggyBankServices interface { + AddPiggyBank([]entityppigybank.PiggyBank) error + EditPiggyBank(piggyID uint, piggyBankInput entityppigybank.PiggyBank) error + DeletePiggyBank(piggyID uint) error + GetAllPiggyBank() ([]entityppigybank.PiggyBankRequest, error) + GetPiggyBankByID(piggyBank uint) (entityppigybank.PiggyBank, error) +} diff --git a/entity/piggy_bank/model/piggy_bank.go b/entity/piggy_bank/model/piggy_bank.go new file mode 100644 index 0000000..94525c1 --- /dev/null +++ b/entity/piggy_bank/model/piggy_bank.go @@ -0,0 +1,13 @@ +package entityppigybank + +import "time" + +type ( + PiggyBank struct { + ID uint + TotalAmount uint + SerialNumber string + Status uint + StatusChangedAt *time.Time + } +) diff --git a/entity/piggy_bank/model/piggy_bank_request.go b/entity/piggy_bank/model/piggy_bank_request.go new file mode 100644 index 0000000..e52c6cd --- /dev/null +++ b/entity/piggy_bank/model/piggy_bank_request.go @@ -0,0 +1,12 @@ +package entityppigybank + +type ( + PiggyBankRequest struct { + ID uint + TypeId uint + CountRequested uint + CountAccepted uint + BenefactorID uint + Description string + } +) diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..0499f74 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module https://git.gocasts.ir/ebhomengo/niki + +go 1.19 diff --git a/main.go b/main.go new file mode 100644 index 0000000..c6217af --- /dev/null +++ b/main.go @@ -0,0 +1,5 @@ +package niki + +func main() { + +} diff --git a/service/piggy_bank/init.go b/service/piggy_bank/init.go new file mode 100644 index 0000000..17da363 --- /dev/null +++ b/service/piggy_bank/init.go @@ -0,0 +1,3 @@ +package piggy_bank + +