mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Merge pull request #279 from LD-Reborn/feature/issue_91
Issue 91: Cleanup: Fix controller methods and method name
This commit is contained in:
@@ -19,7 +19,7 @@ public class GroupsController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("Get")]
|
[HttpGet("Get")]
|
||||||
public async Task<GroupsGetResponseModel> GetAsync(GroupsIndexRequestModel model)
|
public async Task<GroupsGetResponseModel> GetAsync(GroupsGetRequestModel model)
|
||||||
{
|
{
|
||||||
if (model is null)
|
if (model is null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,18 +19,18 @@ public class LocationsController : Controller
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("Index")]
|
[HttpGet("GetAll")]
|
||||||
public async Task<LocationsIndexResponseModel> Index()
|
public async Task<LocationsGetAllResponseModel> GetAll()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IEnumerable<LocationModel> list = await _ldap.ListLocationsAsync();
|
IEnumerable<LocationModel> list = await _ldap.ListLocationsAsync();
|
||||||
return new LocationsIndexResponseModel { Locations = list };
|
return new LocationsGetAllResponseModel { Locations = list };
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError("Unable to list locations: {Message} - {StackTrace}", ex.Message, ex.StackTrace);
|
_logger.LogError("Unable to list locations: {Message} - {StackTrace}", ex.Message, ex.StackTrace);
|
||||||
return new LocationsIndexResponseModel { Locations = [] };
|
return new LocationsGetAllResponseModel { Locations = [] };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ public class LocationsController : Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("Delete")]
|
[HttpDelete("Delete")]
|
||||||
public async Task<LocationsDeleteResponseModel> DeleteAsync(string cn)
|
public async Task<LocationsDeleteResponseModel> DeleteAsync(string cn)
|
||||||
{
|
{
|
||||||
if (cn is null)
|
if (cn is null)
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ public class UsersController : Controller
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("Index")]
|
[HttpGet("GetAll")]
|
||||||
public async Task<IEnumerable<UserModel>> Index(UsersIndexRequestModel requestModel)
|
public async Task<IEnumerable<UserModel>> GetAll(UsersGetAllRequestModel requestModel)
|
||||||
{
|
{
|
||||||
string? uid = requestModel.Uid;
|
string? uid = requestModel.Uid;
|
||||||
List<string> attributes = ["cn", "sn", "title", "uid", "jpegPhoto", "userPassword", "description"];
|
List<string> attributes = ["cn", "sn", "title", "uid", "jpegPhoto", "userPassword", "description"];
|
||||||
@@ -46,7 +46,7 @@ public class UsersController : Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("Delete")]
|
[HttpDelete("Delete")]
|
||||||
public async Task<UsersDeleteRequestModel> Delete(string uid)
|
public async Task<UsersDeleteRequestModel> Delete(string uid)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
|
|||||||
|
|
||||||
namespace Berufsschule_HAM.Models;
|
namespace Berufsschule_HAM.Models;
|
||||||
|
|
||||||
public class GroupsIndexRequestModel
|
public class GroupsGetRequestModel
|
||||||
{
|
{
|
||||||
public string? Cn { get; set; }
|
public string? Cn { get; set; }
|
||||||
public bool GidNumber { get; set; } = true;
|
public bool GidNumber { get; set; } = true;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class LocationsDeleteResponseModel(bool successful, string exception = "N
|
|||||||
public string? Exception { get; set; } = exception;
|
public string? Exception { get; set; } = exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LocationsIndexResponseModel
|
public class LocationsGetAllResponseModel
|
||||||
{
|
{
|
||||||
public required IEnumerable<LocationModel> Locations { get; set; }
|
public required IEnumerable<LocationModel> Locations { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using System.Text.Json.Serialization;
|
|||||||
|
|
||||||
namespace Berufsschule_HAM.Models;
|
namespace Berufsschule_HAM.Models;
|
||||||
|
|
||||||
public class UsersIndexRequestModel
|
public class UsersGetAllRequestModel
|
||||||
{
|
{
|
||||||
public string? Uid { get; set; } = null;
|
public string? Uid { get; set; } = null;
|
||||||
public bool Cn { get; set; } = true;
|
public bool Cn { get; set; } = true;
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: 'GET',
|
method: 'DELETE',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json'
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
method: 'GET',
|
method: 'DELETE',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json'
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
|
|
||||||
async function loadLocationsIntoSelect(selectElement, selectedValue = null) {
|
async function loadLocationsIntoSelect(selectElement, selectedValue = null) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/Locations/Index');
|
const response = await fetch('/Locations/GetAll');
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const locations = data.locations;
|
const locations = data.locations;
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ async function loadLocationsIntoSelect(selectElement, selectedValue = null) {
|
|||||||
|
|
||||||
async function loadUsersIntoSelect(selectElement, selectedValue = null) {
|
async function loadUsersIntoSelect(selectElement, selectedValue = null) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/Users/Index?Cn=false&Sn=false&Title=false&Description=false&JpegPhoto=false&UserPassword=false');
|
const response = await fetch('/Users/GetAll?Cn=false&Sn=false&Title=false&Description=false&JpegPhoto=false&UserPassword=false');
|
||||||
const users = await response.json();
|
const users = await response.json();
|
||||||
|
|
||||||
const ts = selectElement.tomselect;
|
const ts = selectElement.tomselect;
|
||||||
|
|||||||
Reference in New Issue
Block a user