gabrielshufelt / Real-Ratings-SOEN-341_Project_F24

0 stars 1 forks source link

Create Course Model with Relevant Features and Associations #66

Closed Luqman1008 closed 2 weeks ago

Luqman1008 commented 2 weeks ago

Description:

Create a Course model to store course data and establish relationships between instructors, students, and projects. This model will be essential for managing course information and linking it to the projects and users (instructors/students).

Key Elements:

  1. Course Attributes:

    • Name: String, required (e.g., "SOEN 341").
    • Description: Text, optional, provides additional details about the course.
    • Instructor ID: Foreign key linking the course to the User model.
  2. Associations:

    • Instructor:
      • A course belongs_to an instructor.
      • The association will be established by adding a foreign_key: instructor_id in the Course model.
    • Students:
      • A course has_many students through an enrollment or membership system.
      • Use a join table (courses_students) or a CourseMembership model to associate students with multiple courses.
    • Projects:
      • A course has_many projects.
      • Each project will be linked to a course by a course_id foreign key.
    • Evaluations:
      • A course has_many evaluations through projects.
      • Evaluations will be indirectly linked to courses via projects.
  3. Validations:

    • Name: Must be present and unique within the scope of the instructor (i.e., an instructor cannot have two courses with the same name).
    • Description: Optional, but has a character limit to prevent overly long descriptions.
  4. Technical Details:

    • Generate a migration to create the courses table with the following fields:
      • name (string)
      • description (text)
      • instructor_id (foreign key)
    • Ensure that associations with instructors, students, and projects are set up properly in both the Course model and other related models (User, Project).
    • don't forget to replace 'course_name' from teams to 'project_id' to link a team -> project -> course.
    • add description to teams
    • add course_id to projects
    • remove 'team_id' & instructor_id from users
gabrielshufelt commented 2 weeks ago

linked to #71