From 4ff6e05547f47b0b9b0e950ac2cdfff16cd6810d Mon Sep 17 00:00:00 2001 From: libexi01 Date: Thu, 11 Jul 2024 21:54:59 +0530 Subject: [PATCH] 14 --- src/faculty_controller.v | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/faculty_controller.v b/src/faculty_controller.v index fd41036..0254387 100644 --- a/src/faculty_controller.v +++ b/src/faculty_controller.v @@ -2,9 +2,11 @@ module main import vweb - @['/controller/faculty'; post] -pub fn (mut app App) controller_get_faculty(email string, password string) vweb.Result { +pub fn (mut app App) controller_get_faculty() vweb.Result { + email := app.query['email'] + password := app.query['password'] + response := app.service_get_faculty(email, password) or { app.set_status(400, '') return app.text('${err}') @@ -13,7 +15,12 @@ pub fn (mut app App) controller_get_faculty(email string, password string) vweb. } @['/controller/faculty/create'; post] -pub fn (mut app App) controller_create_faculty(firstname string, lastname string, email string, password string) vweb.Result { +pub fn (mut app App) controller_create_faculty() vweb.Result { + firstname := app.query['firstname'] + lastname := app.query['lastname'] + email := app.query['email'] + password := app.query['password'] + if firstname == '' { app.set_status(400, '') return app.text('firstname cannot be empty')