Exemplo n.º 1
0
func UserCreateController(w http.ResponseWriter, r *http.Request) {
	userManager := models.UserManager{}
	user := models.User{Type: rand.Intn(3)}
	userManager.Create(&user)

	utils.WriteJson(w, &user)
}
Exemplo n.º 2
0
func ChatroomCreateController(w http.ResponseWriter, r *http.Request) {
	chatroomManager := models.ChatroomManager{}

	// 1 hour
	endDatetime := time.Now().Add(time.Duration(1) * time.Hour)

	chatroom := models.Chatroom{Code: utils.GetGUID(), MaxMembers: 5, EndDatetime: &endDatetime}
	chatroomManager.Create(&chatroom)

	utils.WriteJson(w, &chatroom)
}