Skip to content

Commit

Permalink
Merge branch 'main' into polygon-tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
SashimiDaBest committed Nov 13, 2024
2 parents 4caa289 + 107bed3 commit 1423951
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
14 changes: 14 additions & 0 deletions Controllers/ReviewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,19 @@ public async Task<ActionResult> GetAverageRatingForBuilding([FromRoute] string b
// return average
return Ok(average);
}

/// <summary>
/// Marks a review as flagged
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("flag")]
public async Task<ActionResult> FlagReview([FromQuery] string id)
{
var filter = Builders<Review>.Filter.Eq(x => x.Id, id);
var builder = new UpdateDefinitionBuilder<Review>();
await _reviews.UpdateOneAsync(filter, builder.Set(x => x.Flagged, true));
return Ok();
}
}
}
3 changes: 3 additions & 0 deletions Entities/Review.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public class Review
[BsonElement("dislikeCount"), BsonRepresentation(BsonType.Int32)]
public int? DislikeCount { get; set; }

[BsonElement("flagged"), BsonRepresentation(BsonType.Boolean)]
public bool? Flagged { get; set; }

[BsonElement("buildingId"), BsonRepresentation(BsonType.String)]
public string? BuildingId { get; set; }
}
3 changes: 2 additions & 1 deletion SimpleWebAppReact.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>23c42f04-bdce-493c-98a5-fcbdb4ccebd4</UserSecretsId>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion appsettings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"ConnectionStrings": {
"DbConnection": "mongodb://liu3447:[email protected]:8222",
"DatabaseName": "test"
},
"Logging": {
Expand Down

0 comments on commit 1423951

Please sign in to comment.