Skip to content

Commit

Permalink
chore: update packages
Browse files Browse the repository at this point in the history
- update query references
- update graphql registrations
- update framework  references
  • Loading branch information
Sipho Hlophe committed Aug 29, 2020
1 parent cc03acd commit 3c80fbc
Show file tree
Hide file tree
Showing 37 changed files with 207 additions and 311 deletions.
16 changes: 8 additions & 8 deletions DataAccess/Building/BuildingQueries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ public class BuildingQueries
new Dictionary<string, string>
{
{ "UPDATE_BUILDING", @"
MERGE (b:Building{id: {id}})
MERGE (b:Building{id: $id})
SET b += {
name: {name},
address: {address}
name: $name,
address: $address
}
RETURN b AS building;
"},
{ "UPDATE_BUILDING_RESIDENCY", @"
MATCH (p:Person{id:{personId}}-[r:BASED_IN]->(b:Building{id:{buildingId}}))
MATCH (p:Person{id:$personId}-[r:BASED_IN]->(b:Building{id:$buildingId}))
MERGE (p)-[r2:BASED_IN]->(b)
WITH r, b, p, r2
DELETE r
RETURN b AS building
"},
{ "DEACTIVATE_BUILDING", @"
MATCH (b:Building)
WHERE b.id = {id}
WHERE b.id = $id
SET b.deactivated = timestamp()
RETURN b AS building
" }
Expand All @@ -35,7 +35,7 @@ RETURN b AS building
{
{ "GET_BUILDING", @"
MATCH (b:Building)
WHERE LOWER(b.name) CONTAINS LOWER({name}) OR b.id = {id}
WHERE LOWER(b.name) CONTAINS LOWER({name}) OR b.id = $id
RETURN b {
.id ,
.name ,
Expand All @@ -53,8 +53,8 @@ RETURN building {
headcount: apoc.cypher.runFirstColumn(""RETURN SIZE((this)<-[:BASED_IN]-())"", {this: building}, false),
people: [(building)<-[:BASED_IN]-(p) | p] }
AS building
SKIP {offset}
LIMIT {first}
SKIP $offset
LIMIT $first
" }
};
}
Expand Down
68 changes: 43 additions & 25 deletions DataAccess/Person/PersonQueries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ namespace DataAccess.Person
public class PersonQueries
{
public IDictionary<string, string> Mutations => new Dictionary<string, string>
{
{ "UPDATE_PERSON", @"
{
{
"UPDATE_PERSON", @"
MERGE (p:Person{id: $id})
SET p += {
title: $title
Expand All @@ -19,8 +20,10 @@ public class PersonQueries
, subscriptions: $subscriptions
}
RETURN p AS person;
"},
{ "UPDATE_PERSON_2", @"
"
},
{
"UPDATE_PERSON_2", @"
MERGE (p:Person{id: $id})
SET p += {
mobile: $mobile
Expand All @@ -29,26 +32,32 @@ public class PersonQueries
, knownAs: $knownAs
}
RETURN p AS person;
"},
{ "UPDATE_PERSON_REPORTING", @"
"
},
{
"UPDATE_PERSON_REPORTING", @"
MATCH (m:Person{id:$man}-[r:MANAGES]->(s:Person{id:$sub}))
MERGE (m)-[r2:MANAGES]->(s)
WITH r, s, m, r2
DELETE r
RETURN s
"},
{ "DEACTIVATE_PERSON", @"
"
},
{
"DEACTIVATE_PERSON", @"
MATCH (p:Person)
WHERE p.id = $id
SET p.deactivated = timestamp()
RETURN p
" }
};
"
}
};

public IDictionary<string, string> Queries => new Dictionary<string, string>
{
{ "GET_PERSON", @"
OPTIONAL MATCH (p:Person{id: {id}})
{
{
"GET_PERSON", @"
OPTIONAL MATCH (p:Person{id: $id})
WITH apoc.date.format(p.deactivated, 'yyyyMMdd HH:mm:ss.ms') AS deactivated, p
RETURN p {
.firstname,
Expand All @@ -67,8 +76,10 @@ RETURN p {
building: [(p) -[:BASED_IN]->(b) | b],
deactivated: deactivated
} AS person
"},
{ "GET_PEOPLE", @"
"
},
{
"GET_PEOPLE", @"
MATCH (p:Person)
WITH apoc.date.format(p.deactivated, 'yyyyMMdd HH:mm:ss.ms') AS deactivated, p
RETURN p {
Expand All @@ -90,10 +101,12 @@ RETURN p {
/*deactivated: deactivated*/
} AS person
ORDER BY person.lastname ASC, person.firstname ASC
SKIP {offset}
LIMIT {first}
" },
{ "GET_ME", @"
SKIP $offset
LIMIT first
"
},
{
"GET_ME", @"
MATCH (p:Person)
WHERE LOWER($firstname) CONTAINS LOWER(p.firstname) AND
LOWER($lastname) CONTAINS LOWER(p.lastname) AND
Expand All @@ -117,18 +130,23 @@ RETURN p {
subscriptions: ['meals', 'support', 'leave', 'general'],
deactivated: deactivated
} AS person
" },
{ "GET_FUZZY_PERSON", @"
"
},
{
"GET_FUZZY_PERSON", @"
OPTIONAL MATCH (p:Person)
WHERE LOWER($firstname) CONTAINS LOWER(p.firstname) AND
LOWER($lastname) CONTAINS LOWER(p.lastname)
RETURN p AS person
" },
{ "PERSONAL_NOTES", @"
"
},
{
"PERSONAL_NOTES", @"
WITH apoc.create.uuid() AS uuid
WITH {id: uuid, subject: 'Notification', body: 'test note'} AS note
RETURN [note] AS notes
" }
};
"
}
};
}
}
20 changes: 10 additions & 10 deletions DataAccess/Product/ProductQueries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ public class ProductQueries
public IDictionary<string, string> Mutations => new Dictionary<string, string>
{
{ "UPDATE_PRODUCT", @"
MERGE (p:Product{id: {id}})
MERGE (p:Product{id:$id})
SET p += {
name: {name},
description: {description},
status: {status}
name: $name,
description: $description,
status: $status
}
RETURN p AS product;
"},
{ "UPDATE_PRODUCT_KNOWLEDGE", @"
MATCH (p:Person{id:{personId}}-[r:KNOWS]->(pr:Product{id:{productId}}))
MATCH (p:Person{id:$personId}-[r:KNOWS]->(pr:Product{id:$productId}))
MERGE (p)-[r2:KNOWS]->(pr)
WITH r, pr, p, r2
DELETE r
RETURN pr AS product
"},
{ "UPDATE_PRODUCT_OWNER", @"
MATCH (p:Person{id:{personId}}-[r:OWNS]->(pr:Product{id:{productId}}))
MATCH (p:Person{id:$personId}-[r:OWNS]->(pr:Product{id:$productId}))
MERGE (p)-[r2:OWNS]->(pr)
WITH r, pr, p, r2
DELETE r
RETURN pr AS product
"},
{ "DEACTIVATE_PRODUCT", @"
MATCH (p:Product)
WHERE p.id = {id}
WHERE p.id = $id
SET p.deactivated = timestamp()
RETURN p
" }
Expand All @@ -40,7 +40,7 @@ RETURN p
public IDictionary<string, string> Queries => new Dictionary<string, string>
{
{ "GET_PRODUCT", @"
MATCH (product:Product{id:{id}})
MATCH (product:Product{id:$id})
RETURN product {
.id ,
.name ,
Expand All @@ -61,8 +61,8 @@ RETURN product {
champions: [(product) < -[:KNOWS] - (product_champions: Person) | product_champions]
} AS product
ORDER BY product.name ASC
SKIP {offset}
LIMIT {first}
SKIP $offset
LIMIT $first
" }
};
}
Expand Down
16 changes: 8 additions & 8 deletions DataAccess/Search/SearchQueries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class SearchQueries
public IDictionary<string, string> Queries => new Dictionary<string, string>
{
{ "SEARCH", @"
WITH {query} AS query
WITH $query AS query
OPTIONAL MATCH (p:Person), (b:Building), (pr:Product)
WHERE (toLower(p.title) CONTAINS toLower(query)
OR toLower(p.firstname) CONTAINS toLower(query)
Expand All @@ -34,15 +34,15 @@ WITH p {
} AS person
RETURN DISTINCT person
ORDER BY person.lastname ASC, person.firstname ASC
SKIP {offset}
LIMIT {first}
SKIP $offset
LIMIT $first
"},
{ "ADVANCED_SEARCH", @"
WITH {query} AS query
OPTIONAL MATCH (p:Person), (b:Building), (pr:Product)
WHERE p.title =~ ""(?i).*{query}.*""
OR p.firstname =~ ""(?i){query}.*""
OR p.lastname =~ ""(?i){query}.*""
WHERE p.title =~ ""(?i).*$query.*""
OR p.firstname =~ ""(?i)$query.*""
OR p.lastname =~ ""(?i)$query.*""
OR query CONTAINS "" "" AND (toLower(query) = toLower(p.firstname)+ "" ""+ toLower(p.lastname))
OR query CONTAINS "", "" AND (toLower(query) = toLower(p.lastname)+ "", ""+ toLower(p.firstname))
Expand All @@ -63,8 +63,8 @@ WITH p {
} AS person
RETURN DISTINCT person
ORDER BY person.lastname ASC, person.firstname ASC
SKIP {offset}
LIMIT {first}
SKIP $offset
LIMIT $first
" }
};
}
Expand Down
4 changes: 2 additions & 2 deletions GraphQLCore/BuildingHandlers/BuildingMutation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using GraphQL.Types;
using GraphQLCore.Unions;
using Models.DTOs;
using Models.GraphQLTypes.Building;
using Models.GraphQLTypes.Person;
using GraphQLCore.GraphQLTypes.Building;
using GraphQLCore.GraphQLTypes.Person;

namespace Models.Types
{
Expand Down
2 changes: 1 addition & 1 deletion GraphQLCore/BuildingHandlers/BuildingQuery.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using BusinessServices.Building;
using GraphQL.Types;
using GraphQLCore.Unions;
using Models.GraphQLTypes.Building;
using GraphQLCore.GraphQLTypes.Building;

namespace Models.Types
{
Expand Down
8 changes: 5 additions & 3 deletions GraphQLCore/GraphQLCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@
<PackageReference Include="AutoMapper" Version="10.0.0" />
<PackageReference Include="GraphQL" Version="2.4.0" />
<PackageReference Include="GraphQL.Authorization" Version="2.1.29" />
<PackageReference Include="GraphQL.Common" Version="1.0.3" />
<PackageReference Include="GraphQL.Server.Transports.AspNetCore" Version="3.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Text.Encoding.Extensions" Version="4.3.0" />
<PackageReference Include="System.Text.Json" Version="4.7.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BusinessServices\BusinessServices.csproj" />
<ProjectReference Include="..\Models\Models.csproj" />
</ItemGroup>

<ItemGroup>
<!--<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Http.Abstractions">
<HintPath>C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.aspnetcore.http.abstractions\2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Abstractions.dll</HintPath>
</Reference>
</ItemGroup>
</ItemGroup>-->

</Project>
Loading

0 comments on commit 3c80fbc

Please sign in to comment.