-
Notifications
You must be signed in to change notification settings - Fork 1
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
Reset funds endpoint #100
base: main
Are you sure you want to change the base?
Reset funds endpoint #100
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.
If you want to further expand this to a full account reset here a few things coming to mind:
- Make sure all aircraft are on the ground at least - no active flights, maintenance (not yet fully added) shouldn't matter
- Make sure the user isn't the primary owner of an airline, again don't have that yet fully implemented but the airline model has a FounderID. In the long term the airline will have to be transferred to another user or formally dissolved - whatever that will look like. But refuse to do a reset for an active airline founder.
- Not sure about rented aircraft yet - again not fully implemented. The idea was that you either have to return it or pay for the return to origin.
- All player owned aircraft get returned to the system, custom stuff like aircraft name get removed and variant aircraft changed back to base version.
Timestamp = DateTime.UtcNow, | ||
UserID = user.Id, | ||
Category = FinancialCategory.None, | ||
Expense = user.PersonalAccountBalance - user.PersonalAccountBalance, |
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.
That will just set the Expense to 0, just set user.PersonalAccountBalance here
}; | ||
await this.db.FinancialRecords.AddAsync(resetRecord); | ||
|
||
var saveEx = await this.db.SaveDatabaseChangesAsync(this.logger, "Failed to reset funds"); |
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.
Before saving the changes you also need to actually adjust the user's balance. The financial record above is just the trace record of what happened.
user.PersonalAccountBalance = 0;
/// Damir, 29/11/2023 | ||
/// </remarks> | ||
/// <returns> | ||
/// An asynchronous result that yields the account balances. |
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.
it yields a status string
API endpoint to reset a users funds
Feel like it would be a good option to have.