Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
polinaKoroleva05 committed Dec 15, 2024
2 parents f2d9f6b + c965d49 commit 6f94163
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion server/Controllers/InitController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public async Task Create() =>
[HttpPost("import")]
public async Task<IActionResult> Import([FromBody] Data data)
{

if (data == null)
{
return BadRequest("Данные не были предоставлены.");
Expand Down
7 changes: 6 additions & 1 deletion server/Services/InitService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,14 @@ public async Task<Data> ExportData()
{
Data data = new Data();
data.users = await _arango.Query.FindAsync<User>(_dbName, _uColName, $"x");
data.cells = await _arango.Query.FindAsync<Cell>(_dbName, _cColName, $"x");
data.events = await _arango.Query.FindAsync<Event>(_dbName, _eColName, $"x");
data.warehouses = await _arango.Query.FindAsync<Warehouse>(_dbName, _wColName, $"x");
data.cells = await _arango.Query.FindAsync<Cell>(_dbName, _cColName, $"x");

foreach (Cell cell in data.cells)
{
cell.warehouseAddress = await _arango.Query.SingleOrDefaultAsync<string>(_dbName, _wColName, $"x._key == {cell.warehouseKey}", $"x.address");
}

return data;
}
Expand Down
6 changes: 6 additions & 0 deletions server/test_data/import.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
{
"_key": "aa183db1-825d-415d-b314-4e914f7e6b8a",
"warehouseKey": "94708a72-73b4-4d68-804b-ed55f6a8dea1",
"warehouseAddress": "st. Dzerzhinskogo 6",
"cellNum": 1,
"tierNum": 1,
"isFree": true,
Expand All @@ -103,6 +104,7 @@
{
"_key": "61067a02-d840-4366-9783-368dcf7ecbae",
"warehouseKey": "94708a72-73b4-4d68-804b-ed55f6a8dea1",
"warehouseAddress": "st. Dzerzhinskogo 6",
"cellNum": 2,
"tierNum": 1,
"isFree": true,
Expand All @@ -117,6 +119,7 @@
{
"_key": "0fe43b01-3c26-4b93-bf2b-043f69b89301",
"warehouseKey": "94708a72-73b4-4d68-804b-ed55f6a8dea1",
"warehouseAddress": "st. Dzerzhinskogo 6",
"cellNum": 1,
"tierNum": 2,
"isFree": true,
Expand All @@ -131,6 +134,7 @@
{
"_key": "6bf72554-6199-4e61-b3cf-072d6048ef07",
"warehouseKey": "7ae44ad8-9155-451c-ad97-53e9c52bc810",
"warehouseAddress": "st. Optikov 34 k2, lit. A",
"cellNum": 1,
"tierNum": 1,
"isFree": true,
Expand All @@ -145,6 +149,7 @@
{
"_key": "c5db0291-238e-47c6-b909-143b279c66f1",
"warehouseKey": "7ae44ad8-9155-451c-ad97-53e9c52bc810",
"warehouseAddress": "st. Optikov 34 k2, lit. A",
"cellNum": 1,
"tierNum": 2,
"isFree": true,
Expand All @@ -159,6 +164,7 @@
{
"_key": "41600724-881d-4fa6-a901-33a46a847d9b",
"warehouseKey": "7ae44ad8-9155-451c-ad97-53e9c52bc810",
"warehouseAddress": "st. Optikov 34 k2, lit. A",
"cellNum": 2,
"tierNum": 2,
"isFree": true,
Expand Down

0 comments on commit 6f94163

Please sign in to comment.