muni-logo

Task 01 - Typescript

In the first task, we will not be focusing on the frontend yet, but on typescript and writing clean and quality code. We have prepared an npm project in which we have included all the necessary dependencies, which include, among others, typecript, eslint and prettier. Your task will be to add several types and implement four functions.

Maximum points10 points
Deadline
February 24, 2025

Project Overview

In the project you will find the following important files:

Tasks

Desired output

- getOpenJobs(db)
 
[
  {
    "jobId": 101,
    "title": "Fix Issue #1",
    "description": "...",
    "state": {
      "stateType": "open"
    }
  },
  {
    "jobId": 102,
    "title": "Fix Issue #2",
    "description": "...",
    "state": {
      "stateType": "open"
    }
  },
  {
    "jobId": 103,
    "title": "Fix Issue #3",
    "description": "...",
    "state": {
      "stateType": "open"
    }
  }
]
------------
 
 
- getUnassignedJobPersonPair(db)
 
[
  {
    "id": 2,
    "name": "Eve",
    "role": "employee",
    "jobs": []
  },
  {
    "jobId": 103,
    "title": "Fix Issue #3",
    "description": "...",
    "state": {
      "stateType": "open"
    }
  }
]
------------
 
 
- getEmployeeWithoutManager(db)
 
{
  "id": 4,
  "name": "Mallory",
  "role": "employee",
  "jobs": []
}
------------
 
 
- getAssignedJobs(db)
 
[
  {
    "jobId": 101,
    "assignedPerson": {
      "id": 1,
      "name": "Alice",
      "role": "employee",
      "jobs": [
        {
          "jobId": 101,
          "title": "Fix Issue #1",
          "description": "...",
          "state": {
            "stateType": "open"
          }
        },
        {
          "jobId": 102,
          "title": "Fix Issue #2",
          "description": "...",
          "state": {
            "stateType": "open"
          }
        }
      ]
    }
  },
  {
    "jobId": 102,
    "assignedPerson": {
      "id": 1,
      "name": "Alice",
      "role": "employee",
      "jobs": [
        {
          "jobId": 101,
          "title": "Fix Issue #1",
          "description": "...",
          "state": {
            "stateType": "open"
          }
        },
        {
          "jobId": 102,
          "title": "Fix Issue #2",
          "description": "...",
          "state": {
            "stateType": "open"
          }
        }
      ]
    }
  },
  {
    "jobId": 103
  },
  {
    "jobId": 104,
    "assignedPerson": {
      "id": 3,
      "name": "Bob",
      "role": "manager",
      "jobs": [
        {
          "jobId": 104,
          "title": "Fixing issue #4...",
          "description": "...",
          "state": {
            "stateType": "inProgress",
            "startedDate": "2024-02-09T23:00:00.000Z"
          }
        },
        {
          "jobId": 105,
          "title": "Fixing issue #5...",
          "description": "...",
          "state": {
            "stateType": "inProgress",
            "startedDate": "2024-02-10T23:00:00.000Z"
          }
        }
      ],
      "employees": [
        1,
        2
      ]
    },
    "possibleEmployees": [
      {
        "id": 2,
        "name": "Eve",
        "role": "employee",
        "jobs": []
      }
    ]
  },
  {
    "jobId": 105,
    "assignedPerson": {
      "id": 3,
      "name": "Bob",
      "role": "manager",
      "jobs": [
        {
          "jobId": 104,
          "title": "Fixing issue #4...",
          "description": "...",
          "state": {
            "stateType": "inProgress",
            "startedDate": "2024-02-09T23:00:00.000Z"
          }
        },
        {
          "jobId": 105,
          "title": "Fixing issue #5...",
          "description": "...",
          "state": {
            "stateType": "inProgress",
            "startedDate": "2024-02-10T23:00:00.000Z"
          }
        }
      ],
      "employees": [
        1,
        2
      ]
    },
    "possibleEmployees": [
      {
        "id": 2,
        "name": "Eve",
        "role": "employee",
        "jobs": []
      }
    ]
  },
  {
    "jobId": 106
  },
  {
    "jobId": 107
  }
]
------------

Submission

There should be created a pull request called "Feedback" immediately after accepting the github classroom assignment.

If you have a Feedback pull request

You can push your solution straight to main. You will then see the diff against main in the pull request feedback. Once you have the solution in main, mark the Feedback PR as submitted.

If you don't have a Feedback pull request

It may be that it will be created later, or it may not be created at all... Therefore, as a precaution, create a new branch solution from main as soon as you accept the assignment, and then push your solution to it.