Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.24.2 #530

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/gameboard.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"scope": "csharp",
"description": "Create a Gameboard unit test suite",
"prefix": "test-suite-unit",
"isFileTemplate": true,
"body": [
"namespace Gameboard.Api.Tests.Unit;",
"",
Expand All @@ -17,7 +18,6 @@
"scope": "csharp",
"description": "Start a new Gameboard unit test",
"prefix": "test-unit",
"isFileTemplate": true,
"body": [
"[${0:Theory}, ${1:GameboardAutoData}]",
"public async Task ${TM_FILENAME/Tests\\.cs//g}_$2_$3(IFixture fixture)",
Expand Down
36 changes: 28 additions & 8 deletions .vscode/launch.json.recommended
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (web)",
"name": ".NET Core Launch (dev)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Gameboard.Api/bin/Debug/net7.0/Gameboard.Api.dll",
"program": "${workspaceFolder}/src/Gameboard.Api/bin/Debug/net8.0/Gameboard.Api.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Gameboard.Api",
"stopAtEntry": false,
Expand All @@ -22,15 +21,36 @@
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://localhost:5002"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"name": ".NET Core Launch (test)",
"type": "coreclr",
"request": "attach"
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Gameboard.Api/bin/Debug/net8.0/Gameboard.Api.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Gameboard.Api",
"stopAtEntry": false,
"env": {
"ASPNETCORE_ENVIRONMENT": "Test"
}
},
{
"name": ".NET Core Launch (db only)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Gameboard.Api/bin/Debug/net8.0/Gameboard.Api.dll",
"args": ["--dbonly"],
"cwd": "${workspaceFolder}/src/Gameboard.Api",
"stopAtEntry": false,
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://localhost:5002"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using System.Security.Claims;
using Microsoft.AspNetCore.Authentication;

namespace Gameboard.Api.Tests.Integration.Fixtures
namespace Gameboard.Api.Tests.Integration.Fixtures;

internal class TestClaimsTransformation : IClaimsTransformation
{
internal class TestClaimsTransformation : IClaimsTransformation
{
public Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
{
return Task.FromResult(principal);
}
}
public Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
=> Task.FromResult(principal);
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ await _testContext.WithDataState(state =>
p.Id = fixture.Create<string>();
p.Role = PlayerRole.Member;
p.TeamId = teamId;
p.User = state.Build<Data.User>(fixture, u => u.Id = fixture.Create<string>());
})
]
});
Expand Down
16 changes: 16 additions & 0 deletions src/Gameboard.Api/Data/Entities/FeedbackTemplate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Collections.Generic;

namespace Gameboard.Api.Data;

public sealed class FeedbackTemplate : IEntity
{
public string Id { get; set; }
public string HelpText { get; set;}
public required string Name { get; set; }
public required string Content { get; set; }

public required string CreatedByUserId { get; set; }
public Data.User CreatedByUser { get; set; }
public required ICollection<Data.Game> UseAsFeedbackTemplateForGames { get; set; } = [];
public required ICollection<Data.Game> UseAsFeedbackTemplateForGameChallenges { get; set; } = [];
}
4 changes: 4 additions & 0 deletions src/Gameboard.Api/Data/Entities/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public class Game : IEntity
public bool RequireSynchronizedStart { get; set; } = false;
public bool ShowOnHomePageInPracticeMode { get; set; } = false;

// feedback
public FeedbackTemplate GameChallengesFeedbackTemplate { get; set; }
public FeedbackTemplate GameFeedbackTemplate { get; set; }

public ICollection<Player> AdvancedPlayers { get; set; }
public ICollection<ChallengeSpec> Specs { get; set; } = new List<ChallengeSpec>();
public ICollection<DenormalizedTeamScore> DenormalizedTeamScores = new List<DenormalizedTeamScore>();
Expand Down
1 change: 1 addition & 0 deletions src/Gameboard.Api/Data/Entities/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class User : IEntity
public string SponsorId { get; set; }
public Sponsor Sponsor { get; set; }
public ICollection<ApiKey> ApiKeys { get; set; } = [];
public ICollection<FeedbackTemplate> CreatedFeedbackTemplates { get; set; } = [];
public ICollection<SystemNotification> CreatedSystemNotifications { get; set; } = [];
public ICollection<Player> Enrollments { get; set; } = [];
public ICollection<ManualBonus> EnteredManualBonuses { get; set; } = [];
Expand Down
11 changes: 11 additions & 0 deletions src/Gameboard.Api/Data/GameboardDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ protected override void OnModelCreating(ModelBuilder builder)
b.Property(u => u.GameId).HasMaxLength(40);
});

builder.Entity<FeedbackTemplate>(b =>
{
b.Property(b => b.Name).HasStandardNameLength().IsRequired();
b.Property(b => b.Content).IsRequired();
b.Property(b => b.HelpText).HasMaxLength(200);
b.HasOne(b => b.CreatedByUser).WithMany(u => u.CreatedFeedbackTemplates).IsRequired();
b.HasMany(t => t.UseAsFeedbackTemplateForGameChallenges).WithOne(g => g.GameFeedbackTemplate);
b.HasMany(t => t.UseAsFeedbackTemplateForGames).WithOne(g => g.GameChallengesFeedbackTemplate);
});

builder.Entity<Game>(b =>
{
b.Property(u => u.Id).HasMaxLength(40);
Expand Down Expand Up @@ -454,6 +464,7 @@ protected override void OnModelCreating(ModelBuilder builder)
public DbSet<ExternalGameHost> ExternalGameHosts { get; set; }
public DbSet<ExternalGameTeam> ExternalGameTeams { get; set; }
public DbSet<Feedback> Feedback { get; set; }
public DbSet<FeedbackTemplate> FeedbackTemplates { get; set; }
public DbSet<Game> Games { get; set; }
public DbSet<ManualBonus> ManualBonuses { get; set; }
public DbSet<Player> Players { get; set; }
Expand Down
Loading