Controller modifié mais bug avec test unitaires en local #51

Merged
clement.chieu merged 4 commits from modifGameController into master 1 year ago

@ -26,7 +26,7 @@ namespace API.Controllers
}
logger.LogInformation("[INFORMATION] La requête a renvoyé : {result} ", queryResult);
return Ok(queryResult);
return Content(queryResult.Result, "application/json");
}
[HttpGet("{database}/Tables")]
@ -42,7 +42,7 @@ namespace API.Controllers
}
logger.LogInformation("[INFORMATION] La requête a renvoyé : {result} ", queryResult);
return Ok(queryResult);
return Content(queryResult.Result, "application/json");
}
@ -59,7 +59,7 @@ namespace API.Controllers
}
logger.LogInformation("[INFORMATION] La requête a renvoyé : {result} ", queryResult);
return Ok(queryResult);
return Content(queryResult.Result, "application/json");
}
}
}

@ -56,7 +56,6 @@ public class QueryDataServiceApi : IQueryService<QueryDto>{
resultList.Add(row);
}
string resultJson = JsonConvert.SerializeObject(resultList);
QueryDto queryDto = new QueryDto { Result = resultJson };
@ -104,10 +103,10 @@ public class QueryDataServiceApi : IQueryService<QueryDto>{
tableNames.Add(reader["table_name"].ToString());
}
Dictionary<string, string> tablesDict = new Dictionary<string, string>();
List<object> tablesDict = new List<object>();
foreach (string tableName in tableNames)
{
tablesDict[tableName] = tableName;
tablesDict.Add(new { TableName = tableName});
}
string tablesJson = JsonConvert.SerializeObject(tablesDict);
@ -157,13 +156,13 @@ public class QueryDataServiceApi : IQueryService<QueryDto>{
columnsNames.Add(reader["column_name"].ToString());
}
Dictionary<string, string> columnsDict = new Dictionary<string, string>();
/*List<object> columnsDict = new List<object>();
foreach (string colName in columnsNames)
{
columnsDict[colName] = colName;
}
columnsDict.Add(new { ColumnName = colName});
}*/
string tablesJson = JsonConvert.SerializeObject(columnsDict);
string tablesJson = JsonConvert.SerializeObject(columnsNames);
Console.WriteLine(tablesJson);

Loading…
Cancel
Save