flowchart TB
CLIENT_APP<--req,res-->cmd/api
storage_persistance[(Storage)]<-->pkg/cfg
memory_cache[(Cache)]<-->pkg/cfg
.env[(Env)]<-->pkg/cfg
cmd/api--Log-->TMP
subgraph SERVER_APP
cmd/api<-->pkg/cfg
cmd/api<--*en-->DEFUALT_MODULE
cmd/api<--ctx,*cfg,*en-->ACCOUNT_MODULE
cmd/api<--ctx,*cfg,*en-->STORE_MODULE
cmd/api<--ctx,*cfg,*en-->CATALOG_MODULE
cmd/api<--ctx,*cfg,*en-->TRANSACTION_MODULE
subgraph DEFUALT_MODULE
defualt_module<--*en-->default_http_handler
end
subgraph ACCOUNT_MODULE
account_module<--*en,*cfg-->account_http_handler
account_http_handler<--*ctx,uRepo,rRepo-->account_service
account_service<--cfg.DBCon-->role_repository
account_service<--cfg.DBCon-->user_repository
end
subgraph STORE_MODULE
store_module<--*en,*cfg-->store_http_handler
store_http_handler<--*ctx,uRepo,rRepo-->store_service
store_http_handler<--*ctx,uRepo,rRepo-->store_pref_service
store_service<--cfg.DBCon-->floor_repository
store_service<--cfg.DBCon-->table_repository
store_service<--cfg.DBCon-->room_repository
store_pref_service<--cfg.DBCon-->store_pref_repository
end
subgraph CATALOG_MODULE
end
subgraph TRANSACTION_MODULE
end
end
The important part here is in the Login function where we set that sacred JWT Token in a Cookie.
so wee dont need Bearer token in our authorization header.
mockery
--dir=internal/account/repository/mysql
--name=RoleSqlRepository
--filename=role_sql_repository.go
--output=domain/mocks --outpkg=mocks
more info read the docs.
-
Add new migration
migrate create -ext sql -dir db/migrations example_table
-
Run Migration
POSTGRESQL_URL: 'postgresql://postgres:@localhost:5432/posbe?sslmode=disable'
- set version (dirty state) (version: -1 before last migrate)
migrate -database ${PG_DSN} -path db/migrations force ${VERSION}
- up
migrate -database ${PG_DSN} -path db/migrations up
- down
migrate -database ${PG_DSN} -path db/migrations down
- set version (dirty state) (version: -1 before last migrate)
more info read the docs.