-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
1,825 additions
and
443 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
migrations/schemas/20230410074637-create_service_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
-- +migrate Up | ||
CREATE TABLE IF NOT EXISTS public.operational_services ( | ||
id uuid PRIMARY KEY DEFAULT (uuid()), | ||
created_at TIMESTAMP(6) DEFAULT NOW(), | ||
update_at TIMESTAMP(6) DEFAULT NOW(), | ||
deleted_at TIMESTAMP(6), | ||
name TEXT, | ||
amount INT8, | ||
currency_id UUID REFERENCES public.currencies (id), | ||
note TEXT, | ||
register_date DATE DEFAULT NOW(), | ||
start_at DATE DEFAULT NOW(), | ||
end_at DATE, | ||
is_active BOOLEAN DEFAULT TRUE | ||
); | ||
-- +migrate Down | ||
DROP TABLE public.operational_services; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package invoice | ||
|
||
import "errors" | ||
|
||
var ( | ||
ErrInvoiceNotFound = errors.New("invoice not found") | ||
ErrInvoiceStatusAlready = errors.New("invoice status already") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package invoice | ||
|
||
import ( | ||
"github.com/dwarvesf/fortress-api/pkg/config" | ||
"github.com/dwarvesf/fortress-api/pkg/logger" | ||
"github.com/dwarvesf/fortress-api/pkg/model" | ||
"github.com/dwarvesf/fortress-api/pkg/service" | ||
"github.com/dwarvesf/fortress-api/pkg/store" | ||
"github.com/dwarvesf/fortress-api/pkg/worker" | ||
) | ||
|
||
type controller struct { | ||
store *store.Store | ||
service *service.Service | ||
worker *worker.Worker | ||
logger logger.Logger | ||
repo store.DBRepo | ||
config *config.Config | ||
} | ||
|
||
func New(store *store.Store, repo store.DBRepo, service *service.Service, worker *worker.Worker, logger logger.Logger, cfg *config.Config) IController { | ||
return &controller{ | ||
store: store, | ||
repo: repo, | ||
service: service, | ||
logger: logger, | ||
config: cfg, | ||
worker: worker, | ||
} | ||
} | ||
|
||
type IController interface { | ||
UpdateStatus(in UpdateStatusInput) (*model.Invoice, error) | ||
MarkInvoiceAsError(invoice *model.Invoice) (*model.Invoice, error) | ||
MarkInvoiceAsPaid(invoice *model.Invoice, sendThankYouEmail bool) (*model.Invoice, error) | ||
} |
Oops, something went wrong.