Open shaiweeeen opened 10 months ago
@xlawan kani lng nya unaha
Modified Services and Controllers:
Announcement AnnouncementComment Course CourseEnrollment Issue
Checked and modified messages and applied GeneralViewModel on these files: IssueComment - was not able to test (can't add data to the database yet) OfferedCourse PublicResearchRepository - was not able to test (can't add data to the database yet)
These files was changed to display joined tables: Announcement AnnouncementComment IssueComment
Modified to show Foreign keys: User PublicResearchRepository Issue
Modified to connect with GeneralViewModel PublicResearchRepository
This is how to query specific properties from tables with foreign keys and navigators:
var result = await _context.UserLogs .Select(x => new { UserId = x.User.Id, UserName = x.User.UserName, Idno = x.User.Idno, FullName = x.User.FullName, UserLogId = x.Id, // Include other properties from UserLog entity as needed }) .ToListAsync();
[x] clean all Messages in services, specify errors
[x] clean methods. Apply GeneralViewModel
[x] Examine context queries in services. Make sure entities with associated foreign keys include the other tables in the query. (This is like JOIN when executing pure SQL) example: When getting Enrolled Students from Course Enrollment table (junction table of students and offered courses), make sure to include the Students entity (this is the navigator property that we put in models) so that we can access the properties of the student such as Id, Name...
Be mindful not all needs Include.
We don't want to return data that will not be used. Analyze the system, if you are unsure, just create an issue and label: bug ... title should be API-Include: [add very short description] and I will review.
This is without Role implementation yet