Skip to content

Postgres: Database Schema - Officer Role & Committee Association #95

@smalex-z

Description

@smalex-z

Description:
Add OFFICER role to user accessType and committee assignments to enable committee-scoped permissions.

Acceptance Criteria:

Update User schema accessType enum to include OFFICER:

accessType: Sequelize.ENUM('STANDARD', 'OFFICER', 'ADMIN', 'SUPERUSER')

Add committees field to User schema (JSON array or comma-separated string):

committees: {
  type: Sequelize.ARRAY(Sequelize.STRING), // or Sequelize.TEXT for comma-separated
  defaultValue: [],
  validate: {
    isValidCommittee(value) {
      const validCommittees = ['Hack', 'AI', 'ICPC', 'Studio', 'Cyber', 'W', 'Game', 'Design', 'TeachLA'];
      // validate each committee in array
    }
  }
}

Add isOfficer() method to User model
Add hasCommittee(committee) method to User model
Create migration to add OFFICER to enum and committees field
Update getUserProfile() to return committees and officer status
Seed dev database with sample officers (one for each committee)

Migration Example:
See Najms' PR #74

committees: {
  type: Sequelize.ARRAY(Sequelize.STRING),
  defaultValue: [],
}
// Example values: ['Hack', 'AI'] or ['Studio']

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions