Skip to content

Conversation

chlins
Copy link
Member

@chlins chlins commented Jul 3, 2025

This pull request introduces changes to the Application and Job models in the manager/models package to improve how related User data is handled. The most significant updates include marking the User field with gorm:"-" to exclude it from ORM operations and adding AfterFind hooks to populate the User field after database queries.

Changes to Application model:

Changes to Job model:

  • Marked the User field with gorm:"-" to exclude it from ORM operations. (manager/models/job.go, manager/models/job.goL28-R47)
  • Added an AfterFind hook to populate the User field after database queries by fetching the associated User based on UserID. (manager/models/job.go, manager/models/job.goL28-R47)

Description

Related Issue

Closes #4171

Motivation and Context

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

Signed-off-by: chlins <chlins.zhang@gmail.com>
@chlins chlins requested a review from a team as a code owner July 3, 2025 10:48
@chlins chlins requested review from yxxhero, hyy0322 and akashhr July 3, 2025 10:48
@chlins chlins added the bug label Jul 3, 2025
@chlins chlins added this to the v2.4.0 milestone Jul 3, 2025
@chlins chlins enabled auto-merge (squash) July 3, 2025 10:48
@chlins chlins added enhancement New feature or request and removed bug labels Jul 3, 2025
Copy link

codecov bot commented Jul 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.

Project coverage is 32.85%. Comparing base (b3b7d15) to head (c064e9d).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
manager/models/application.go 0.00% 10 Missing ⚠️
manager/models/job.go 0.00% 10 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4178      +/-   ##
==========================================
- Coverage   32.90%   32.85%   -0.06%     
==========================================
  Files         347      350       +3     
  Lines       40992    41064      +72     
==========================================
+ Hits        13490    13491       +1     
- Misses      26608    26679      +71     
  Partials      894      894              
Flag Coverage Δ
unittests 32.85% <0.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
manager/models/application.go 0.00% <0.00%> (ø)
manager/models/job.go 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@Liam-Zhao Liam-Zhao left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

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

LGTM

@chlins chlins merged commit 1a132f5 into main Jul 3, 2025
20 checks passed
@chlins chlins deleted the fix/populate-user-from-userid branch July 3, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data model userID & user not associated in response
5 participants