File size: 765 Bytes
e762600
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package auth

import (
	"github.com/gin-gonic/gin"
	"godp.abdanhafidz.com/controller"
	"godp.abdanhafidz.com/models"
	"godp.abdanhafidz.com/services"
)

func Register(c *gin.Context) {
	register := services.RegisterService{}
	registerController := controller.Controller[models.RegisterRequest, models.Account, models.Account]{
		Service: &register.Service,
	}
	registerController.RequestJSON(c, func() {
		registerController.Service.Constructor.Password = registerController.Request.Password
		registerController.Service.Constructor.Email = registerController.Request.Email
		registerController.Service.Constructor.Username = registerController.Request.Username
		registerController.Service.Constructor.Role = "USER"
		register.Create()
	})
}