Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
New feature of DLC handling #51
base: Boderator3.0
Are you sure you want to change the base?
New feature of DLC handling #51
Changes from 1 commit
46d96c5
4069d5c
f26186e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 is redundant, you can remove this.
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.
Redundant with what? Something in rest of program?
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 don't need to specify what
Content-Type
you produce if you just useIActionResult
and return the data object. It will be serialized to anyContent-Type
desired by caller.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 it DLCController with
users
path? You probably should have created 2 controllers. One for users, one for dlc.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.
No. You should have separate method for no input instead of special handling for
0
value. And method should be namedGetUser
. Then method for all users would just be namedGetUsers
orGetAllUsers
.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.
If you need to return users, just return users, don't build the json manually.
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.
If you need a list, just create a
List<T>
.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.
Do you want to kill me? Create some response DTO (e.g.
UsersWithDLCReponseDto
) which will contain the list of users and just return the damn object, don't create JObjects from scratch.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 whole foreach loop could be made in LINQ.
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.
Return the response object, don't use
Response
.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 is probably useless in API. Instead just make sure API can return user and his DLCs.
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
DataClasses
is awful and stinks with legacyArmaforcesMissionBot
, don't. You are creating aDLC
feature so almost everything you do should be inFeatures/DLC
folder/namespace. This one will probably go toModels
subfolder.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 not just
User
? This sounds awful.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 should be a property too. Don't use fields for publicly available stuff. And make both the property and the list readonly, e.g.
IReadOnlyList
,IReadOnlyCollection
or maybe evenIReadOnlySet
as it should not have duplicates.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.
What about adding new DLC when property is readonly?
Or you meant something like that?
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, almost, something like this:
We don't want to allow external modifications to any User or his data. This should be only done in
IUserRepository
or something like this, right where it's stored. So we need to always return immutable User object. Then to change anything, you must go throughIUserRepository
which will create new User instance with updated data.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.
What is the purpose of this class? It doesn't have an interface. If you want some class which will allow you to retrieve users data then create an interface for it, e.g
IUsersRepository
and create some useful methods there instead of just returning a list of users.