-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⭕(wip): shipment api and page (#303)
* ✅(add): createdAt column helper * 🟡(change): column visibility * 🪛(fix): trailer form * ✅(add): new validation context function * 🟡(change): add support for user defined time format * 🍪(chore): bump * 🍪(chore): fix readme * 🟡(change): fleet details in trailer api * Update fixtures.yml * 🟡(change): include fleet details in tractor api * 🟡(change): add query params to api logging * bump * ✅(add): shipment validation * 🪛(fix): tests * ✅(add): new test for shipment * 🍪(chore): bump * 🪛(fix): shipment migration fields * ✅(add): shipment api * ✅(add): shipment billing validation * 🪛(fix): migraitons * 🟡(change): shipment api query params * 🟡(change): shipment repo * 🍪(chore): bump fixtures * ⭕(wip): shipment page * 🪛(fix): broken test * 🟡(change): add support for column id * ✅(add): data-table header with tooltip * 🟡(change): date utils to default to military time * 🪛(fix): shipment status enums * Update 20241211015858_shipment_move.tx.up.sql * ✅(add): include customer details in shipment api * Update fixtures.yml * 🟡(wip): pc miler routing * ⭕(wip): shipment page * 🍪(chore): run go imports * ✅(add): location single search * Update page.tsx * ⭕(wip): shipment page * ⭕(wip): shipment map view * 🟡(change): loading skeleton * bump * 🟡(change): add discord badge
- Loading branch information
Showing
132 changed files
with
6,166 additions
and
272 deletions.
There are no files selected for viewing
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
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,61 @@ | ||
package routing | ||
|
||
import ( | ||
"github.com/emoss08/trenova/internal/api/middleware" | ||
"github.com/emoss08/trenova/internal/core/ports/repositories" | ||
"github.com/emoss08/trenova/internal/core/services/routing" | ||
"github.com/emoss08/trenova/internal/pkg/ctx" | ||
"github.com/emoss08/trenova/internal/pkg/validator" | ||
"github.com/gofiber/fiber/v2" | ||
"go.uber.org/fx" | ||
) | ||
|
||
type HandlerParams struct { | ||
fx.In | ||
|
||
RoutingService *routing.Service | ||
ErrorHandler *validator.ErrorHandler | ||
} | ||
|
||
type Handler struct { | ||
rs *routing.Service | ||
eh *validator.ErrorHandler | ||
} | ||
|
||
func NewHandler(p HandlerParams) *Handler { | ||
return &Handler{ | ||
rs: p.RoutingService, | ||
eh: p.ErrorHandler, | ||
} | ||
} | ||
|
||
func (h Handler) RegisterRoutes(r fiber.Router, rl *middleware.RateLimiter) { | ||
api := r.Group("/routing") | ||
|
||
api.Get("/single-search", rl.WithRateLimit( | ||
[]fiber.Handler{h.singleSearch}, | ||
middleware.PerMinute(120), | ||
)...) | ||
} | ||
|
||
func (h Handler) singleSearch(c *fiber.Ctx) error { | ||
reqCtx, err := ctx.WithRequestContext(c) | ||
if err != nil { | ||
return h.eh.HandleError(c, err) | ||
} | ||
|
||
opts := routing.SingleSearchParams{ | ||
Query: c.Query("query"), | ||
ConfigOpts: repositories.GetPCMilerConfigurationOptions{ | ||
OrgID: reqCtx.OrgID, | ||
BuID: reqCtx.BuID, | ||
}, | ||
} | ||
|
||
resp, err := h.rs.SingleSearch(c.UserContext(), opts) | ||
if err != nil { | ||
return h.eh.HandleError(c, err) | ||
} | ||
|
||
return c.JSON(resp) | ||
} |
Oops, something went wrong.