initial commit. Cloned timetracker repository
This commit is contained in:
10
app/utils/response/messages.go
Normal file
10
app/utils/response/messages.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package response
|
||||
|
||||
import "git.ma-al.com/goc_marek/timetracker/app/utils/i18n"
|
||||
|
||||
type ResponseMessage i18n.I18nTranslation
|
||||
|
||||
const (
|
||||
Message_OK ResponseMessage = "message_ok"
|
||||
Message_NOK ResponseMessage = "message_nok"
|
||||
)
|
||||
18
app/utils/response/response.go
Normal file
18
app/utils/response/response.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package response
|
||||
|
||||
import "github.com/gofiber/fiber/v3"
|
||||
|
||||
type Response[T any] struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
Items *T `json:"items,omitempty"`
|
||||
Count *int `json:"count,omitempty"`
|
||||
}
|
||||
|
||||
func Make[T any](c fiber.Ctx, status int, items *T, count *int, message string) Response[T] {
|
||||
c.Status(status)
|
||||
return Response[T]{
|
||||
Message: message,
|
||||
Items: items,
|
||||
Count: count,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user