fix for frontend detail handler

This commit is contained in:
Michael Quigley 2023-06-26 16:47:09 -04:00
parent 5d2d7b1b00
commit 881c263132
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62

View File

@ -45,16 +45,19 @@ func (h *getFrontendDetailHandler) Handle(params metadata.GetFrontendDetailParam
logrus.Errorf("environment not matched for frontend '%d' for account '%v'", fe.Id, principal.Email) logrus.Errorf("environment not matched for frontend '%d' for account '%v'", fe.Id, principal.Email)
return metadata.NewGetFrontendDetailNotFound() return metadata.NewGetFrontendDetailNotFound()
} }
shr, err := str.GetShare(fe.Id, trx) payload := &rest_model_zrok.Frontend{
ID: int64(fe.Id),
ZID: fe.ZId,
CreatedAt: fe.CreatedAt.UnixMilli(),
UpdatedAt: fe.UpdatedAt.UnixMilli(),
}
if fe.PrivateShareId != nil {
shr, err := str.GetShare(*fe.PrivateShareId, trx)
if err != nil { if err != nil {
logrus.Errorf("error getting share for frontend '%d': %v", fe.Id, err) logrus.Errorf("error getting share for frontend '%d': %v", fe.Id, err)
return metadata.NewGetFrontendDetailInternalServerError() return metadata.NewGetFrontendDetailInternalServerError()
} }
return metadata.NewGetFrontendDetailOK().WithPayload(&rest_model_zrok.Frontend{ payload.ShrToken = shr.Token
ID: int64(fe.Id), }
ShrToken: shr.Token, return metadata.NewGetFrontendDetailOK().WithPayload(payload)
ZID: fe.ZId,
CreatedAt: fe.CreatedAt.UnixMilli(),
UpdatedAt: fe.UpdatedAt.UnixMilli(),
})
} }