mirror of
https://github.com/versia-pub/versia-go.git
synced 2026-03-13 12:39:15 +01:00
refactor(server): rename stuff from Lysand to Versia
Big diff energy
This commit is contained in:
parent
03e01548dc
commit
cb135706e2
29 changed files with 103 additions and 96 deletions
|
|
@ -50,5 +50,5 @@ func (i *Handler) SearchUser(c *fiber.Ctx) error {
|
|||
return api_schema.ErrNotFound(nil)
|
||||
}
|
||||
|
||||
return c.JSON((*api_schema.VersiaUser)(u.ToLysand()))
|
||||
return c.JSON((*api_schema.VersiaUser)(u.ToVersia()))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,6 @@ func (i *Handler) Register(r fiber.Router) {
|
|||
r.Get("/api/app/users/:id", i.GetUser)
|
||||
r.Post("/api/app/users/", i.CreateUser)
|
||||
|
||||
r.Get("/api/users/:id", i.GetLysandUser)
|
||||
r.Post("/api/users/:id/inbox", i.LysandInbox)
|
||||
r.Get("/api/users/:id", i.GetVersiaUser)
|
||||
r.Post("/api/users/:id/inbox", i.HandleVersiaInbox)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/lysand-org/versia-go/internal/api_schema"
|
||||
)
|
||||
|
||||
func (i *Handler) LysandInbox(c *fiber.Ctx) error {
|
||||
func (i *Handler) HandleVersiaInbox(c *fiber.Ctx) error {
|
||||
if err := i.requestValidator.ValidateFiberCtx(c.UserContext(), c); err != nil {
|
||||
if errors.Is(err, val_impls.ErrInvalidSignature) {
|
||||
i.log.Error(err, "Invalid signature")
|
||||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/lysand-org/versia-go/internal/api_schema"
|
||||
)
|
||||
|
||||
func (i *Handler) GetLysandUser(c *fiber.Ctx) error {
|
||||
func (i *Handler) GetVersiaUser(c *fiber.Ctx) error {
|
||||
parsedRequestedUserID, err := uuid.Parse(c.Params("id"))
|
||||
if err != nil {
|
||||
return c.Status(fiber.StatusBadRequest).JSON(fiber.Map{
|
||||
|
|
@ -27,5 +27,13 @@ func (i *Handler) GetLysandUser(c *fiber.Ctx) error {
|
|||
return api_schema.ErrNotFound(map[string]any{"id": parsedRequestedUserID})
|
||||
}
|
||||
|
||||
return i.requestSigner.Sign(c, u.Signer, u.ToLysand())
|
||||
if err := i.requestSigner.SignAndSend(c, u.Signer, u.ToVersia()); err != nil {
|
||||
i.log.Error(err, "Failed to sign response body", "id", parsedRequestedUserID)
|
||||
|
||||
return api_schema.ErrInternalServerError(map[string]any{
|
||||
"reason": "failed to sign response body",
|
||||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue