/* ScheduleTogether Backend Copyright (C) 2024, Zervó Zadachin DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License version 3 for more details. This program incorporates external libraries for certain functionalities. These libraries are covered by their respective licenses, and their usage agreements are as outlined in their respective documentation or source code. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ package handlers import ( "github.com/kataras/iris/v12" "git.zervo.org/scheduletogether/backend/internal/api/middlewares" "git.zervo.org/scheduletogether/backend/internal/api/services/users" perms "git.zervo.org/scheduletogether/backend/pkg/permissions" ) // UserHandler_RegisterRoutes registers routes for the UserHandler func UsersHandler_RegisterRoutes(party iris.Party) { party.Use(middlewares.Authenticate()) // only allow authenticated users for following endpoints party.Get("/", middlewares.Authorize(perms.GetAllUsers), UsersGet_Handler) party.Get("/id/:id", middlewares.Authorize(perms.GetUserById), UsersGetById_Handler) party.Get("/uuid/:uuid", middlewares.Authorize(perms.GetUserByUuid), UsersGetByUuid_Handler) party.Get("/self", middlewares.Authorize(perms.GetOwnUser), UsersGetSelf_Handler) } func UsersGet_Handler(ctx iris.Context) { // Call the UsersGet_Service function to get all users users.UsersGet_Service(ctx) } func UsersGetById_Handler(ctx iris.Context) { // Call the UsersGetById_Service function to get a single user by id users.UsersGetById_Service(ctx) } func UsersGetByUuid_Handler(ctx iris.Context) { // Call the UsersGetByUuid_Service function to get a single user by uuid users.UsersGetByUuid_Service(ctx) } func UsersGetSelf_Handler(ctx iris.Context) { // Call the UsersGetSelf_Service function to get the current user users.UsersGetSelf_Service(ctx) }