Skip to content

637 Feature: Daily Player Emotions#775

Open
CapoMK25 wants to merge 6 commits intodevfrom
637-feature-request-player-data-should-contain-information-about-the-daily-emotions-for-the-past-week
Open

637 Feature: Daily Player Emotions#775
CapoMK25 wants to merge 6 commits intodevfrom
637-feature-request-player-data-should-contain-information-about-the-daily-emotions-for-the-past-week

Conversation

@CapoMK25
Copy link
Copy Markdown
Collaborator

Brief description

The UI Team lead Niko opened an issue last year regarding adding emotions to the backend API. This has now been implemented, unit tested and tested on Postman as well on this PR.

Change list

  • Added PlayerEmotion enum and updated PlayerSchema with a history array.

  • Implemented GET /player/emotioncheck to let the client know if the daily popup is needed.

  • Implemented POST /player/emotion to record daily sentiment (limited to once per day).

  • Fix: Resolved path alias issues in tests by switching to relative imports in the Schema.

  • Fix: Resolved controller routing collision by reordering static routes above dynamic parameters.

  • Fix: Aligned controller with req.user.player_id to ensure correct database targeting.

Copy link
Copy Markdown
Member

@hoan301298 hoan301298 left a comment

Choose a reason for hiding this comment

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

This PR needs to be fixed and should cover all of following rules.

Copy link
Copy Markdown
Member

@hoan301298 hoan301298 left a comment

Choose a reason for hiding this comment

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

There are a few issues needed to fix in this PR. But in overall, it looks good to me. Approved!

* @returns - A classic tuple setup [boolean, ServiceError[]] indicating if an entry for today exists.
*/
async checkIfEmotionSentToday(playerId: string): Promise<IServiceReturn<EmotionCheckDto>> {
const player = await this.model
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suggest, it's better if you can use BasicService functions.

So maybe this function should be return <IServiceReturn<boolean>>.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in my latest commit.

@Post('/emotion')
@UniformResponse(ModelName.PLAYER, PlayerDto)
@Authorize({ action: Action.create, subject: PlayerDto })
public async setDailyEmotion(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This controller function should return nothing, since you return 201 status_code (means No Content).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed in my latest commit.

@github-project-automation github-project-automation bot moved this from Backlog to Done in Altzone-Server Apr 4, 2026
@CapoMK25 CapoMK25 requested review from Iir0R and psykkis as code owners April 4, 2026 17:14
@CapoMK25
Copy link
Copy Markdown
Collaborator Author

CapoMK25 commented Apr 4, 2026

@hoan301298 or @Iir0R you can check and approve once more before I hit merge on this, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Feature request: Player data should contain information about the daily emotions for the past week.

2 participants