formated all files

This commit is contained in:
QkoSad
2024-12-04 15:46:10 +02:00
parent cb7b3ad94c
commit 926436860c
34 changed files with 360 additions and 169 deletions
+25 -14
View File
@@ -1,5 +1,4 @@
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using MySql.Data.MySqlClient;
using Newtonsoft.Json;
@@ -34,11 +33,12 @@ namespace Server
string? offset = queryString["offset"];
string? order = queryString["order"];
order = order == "true" ? "ASC" : "DESC";
// this shenanigan is needed to remove the "" around group by
string mainQuery = @"SELECT u.f_name,u.l_name,u.mail,p.name,t.time,t.date,t.user
string mainQuery =
@"SELECT u.f_name,u.l_name,u.mail,p.name,t.time,t.date,t.user
FROM Timelog t
INNER JOIN Project p ON p.id=t.project
INNER JOIN User u ON u.id=t.user ";
// this shenanigan is needed to remove the "" around group by
string offsetQuery = " LIMIT 10 OFFSET " + offset + ";";
// depending on the incoming parameters construct a Query
if (!string.IsNullOrEmpty(to) && !string.IsNullOrEmpty(from))
@@ -53,7 +53,16 @@ namespace Server
}
if (!string.IsNullOrEmpty(sortby))
{
List<string> validSorting = new List<string> { "f_name", "l_name", "mail", "time", "date", "user", };
List<string> validSorting = new List<string>
{
"f_name",
"l_name",
"mail",
"time",
"date",
"user",
"project",
};
if (!validSorting.Contains(sortby))
{
throw new Exception("Incorrect sorting value");
@@ -79,16 +88,18 @@ namespace Server
List<Log> entries = new List<Log>();
while (reader.Read())
{
entries.Add(new Log
{
f_name = reader["f_name"],
l_name = reader["l_name"],
user = reader["user"],
date = reader["date"],
name = reader["name"],
time = reader["time"],
mail = reader["mail"],
});
entries.Add(
new Log
{
f_name = reader["f_name"],
l_name = reader["l_name"],
user = reader["user"],
date = reader["date"],
name = reader["name"],
time = reader["time"],
mail = reader["mail"],
}
);
}
// serialize JSON
string jsonResponse = JsonConvert.SerializeObject(entries);