blob: 5613ade6f21c6fad973164440d6d0c72d9d8f4ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package domain
import (
domainService "dove/services/domain"
"dove/utils/meta"
"dove/utils/shortcuts"
"github.com/gofiber/fiber/v2"
)
func CreateDomain(context *fiber.Ctx) error {
body, parseError := meta.Body[domainService.CreateDomainRequest](context)
if parseError != nil {
return shortcuts.BadRequestError(context, parseError)
}
serviceError := domainService.CreateDomain(body)
if serviceError != nil {
return shortcuts.HandleError(context, serviceError)
}
return shortcuts.Redirect(context, "domains.manage")
}
func CreateTLD(context *fiber.Ctx) error {
body, parseError := meta.Body[domainService.CreateTLDRequest](context)
if parseError != nil {
return shortcuts.BadRequestError(context, parseError)
}
serviceError := domainService.CreateTLD(body)
if serviceError != nil {
return shortcuts.HandleError(context, serviceError)
}
return shortcuts.Redirect(context, "domains.tlds")
}
func DeleteTLD(context *fiber.Ctx) error {
serviceError := domainService.DeleteTLD(meta.Request(context).Param("name"))
if serviceError != nil {
return shortcuts.HandleError(context, serviceError)
}
return shortcuts.Redirect(context, "domains.tlds")
}
|