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

Server stats #133

Merged
merged 4 commits into from
Oct 3, 2024
Merged

Server stats #133

merged 4 commits into from
Oct 3, 2024

Conversation

tobibodamer
Copy link
Collaborator

No description provided.

@tobibodamer tobibodamer requested a review from metalglove October 2, 2024 19:31
Copy link
Collaborator

@metalglove metalglove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments

MatchmakingServer/Parties/PartyService.cs Show resolved Hide resolved
@@ -199,4 +199,21 @@ [new Claim(ClaimTypes.Name, playerName),
return Results.SignIn(claimsPrincipal);
});

app.MapGet("/stats", (PlayerStore playerStore, ServerStore serverStore, PartyService partyService, Matchmaker matchmaker) =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the Program.cs file is getting quite lengthy.
It might be time to clean it up and extract how services are set up and how the app is build.

Furthermore, I if an endpoint changes or w/e, you shouldn't have to change the program.cs file.
I recommend to just make a controller for http request maps. It is just a bit better separation. (imo)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we should definetely clean it up, same for the App.xaml.cs. I will create an issue for that, maybe i can clean it up as part of the multi-game refactoring.

I do like minimal api though it is more performant and... minimal :D So for single endpoints i think it makes sense. Would you be fine with putting them into seperate extension methods / classes?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But isn't that just the same as adding a controller class? xD

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean :D at first glance it looks the same but you dont have the slow controller pipeline and everything is more ✨ functional ✨. You only get the dependencies you need for that single endpoint.

Check out this example or REPR. There is this new trend towards vertical slice architecture. Not saying we should necessarily use that, but it definetely has advantages

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you make it like that example? That would be nice. And it is out of the program cs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes will do that. Also a good time to add some validation to the login endpoint

Clean up 'Program.cs' a bit
Fix matchmaking namespace
@tobibodamer tobibodamer requested a review from metalglove October 2, 2024 23:15
Copy link
Collaborator

@metalglove metalglove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I like the FluentValidation too! I always used that :)

@tobibodamer tobibodamer merged commit 6d764a0 into main Oct 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants