-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add annotations and pieces tables #245
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like good progress; a few comments.
Data/Data.csproj
Outdated
@@ -13,6 +13,12 @@ | |||
<Compile Remove="Migrations\20190214050904_CheatsAndWhistles.cs" /> | |||
</ItemGroup> | |||
|
|||
<ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can undo this (it's just removing files that you no longer have)
/// The annotation contents | ||
/// </summary> | ||
[Required] | ||
[StringLength(255)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 255 long enough for what you're doing? If you're not sure, you can leave this off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's long enough. I set it intentionally small so that no one could use annotations to store huge amounts of data on our server. Maybe some future puzzle writer will want it longer, but at that point it should be easy to just increase this number.
Data/DataModel/Piece.cs
Outdated
|
||
/// <summary> | ||
/// The minimum progress level for a team at which this piece should be | ||
/// revealed to that team |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace tab with spaces
Data/DataModel/Piece.cs
Outdated
/// The contents of the piece | ||
/// </summary> | ||
[Required] | ||
[StringLength(4096)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for this limit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really; I'll remove it.
column: x => x.PuzzleID, | ||
principalTable: "Puzzles", | ||
principalColumn: "ID", | ||
onDelete: ReferentialAction.Cascade); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand.
|
||
namespace ServerCore.Pages.Pieces | ||
{ | ||
[Authorize(Policy = "IsAuthorOfPuzzle")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
|
||
public async Task<IActionResult> OnGetAsync(int? id) | ||
{ | ||
if (id == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have a nullable ID if we'd return 404 if it's null?
|
||
public async Task<IActionResult> OnPostAsync(int? id) | ||
{ | ||
if (id == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
|
||
namespace ServerCore.Pages.Pieces | ||
{ | ||
[Authorize(Policy = "IsAuthorOfPuzzle")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same auth comment
ServerCore/ServerCore.csproj
Outdated
@@ -25,6 +25,11 @@ | |||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.2" /> | |||
<PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="2.1.2" /> | |||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.1.0" /> | |||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.2" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you add these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wiki said to follow the instructions at
https://docs.microsoft.com/en-us/ef/core/get-started/install/
to get started with EF Core. Those instructions said to install Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityFrameworkCore.Tools. So I did.
I then updated the wiki here to include all those details:
https://github.com/PuzzleServer/mainpuzzleserver/wiki/Local-Development-Environment-Setup
20c0615
to
c48db5f
Compare
This pull request creates the annotations table (for storing per-team, per-puzzle annotations for puzzles that need them) and the pieces table (for storing pieces of a puzzle that teams earn as they make progress). It also creates CRUD pages for the pieces table.