This commit is contained in:
2024-07-11 21:54:59 +05:30
parent c5f4cccce4
commit 4ff6e05547

View File

@@ -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')