pledge4future/WePledge

Endpoint for overview of emission entries

codingfabi opened this issue · 1 comments

We want to be able to show the users an interactive overview of the emission entries they have created (see #139).

To implement this we first need 4 query endpoints for each entry type that returns the entries created by the provided user. The endpoints should function in the following way:

Heating Overview

Should only be available for working group representatives. Should return all heating entries for the working group that the logged in user is a representative of. It should provide the following information:

{
 timestamp: date
 emissions: number
 eMail of creating user: string
 fuel type: string
}

Electricity Overview

Similar to heating, should only be available for working group representatives. Should return all electricity entries for the working group that the logged in user is a representative of. It should provide the following information:

{
 timestamp: date
 emissions: number
 eMail of creating user: string
 fuel type: string
}

Commuting Overview

Should return all commuting entries that the logged in user has created. It should provide the following information:

{
 timestamp: date,
 start date: date,
 end date: date,
 distance: number,
 emissions: number,
 transportation type: string
}

Business Trip

Should return all business trip entries that the logged in user has created. It should provide the following information:

 timestamp: date,
 distance: number,
 emissions: number,
 transportation type: string

I think these endpoints are already implemented. These would be the queries:

Business trips

query {
    businesstrips {
       timestamp
       distance
       co2e
       transportationMode
  }
}

Commuting

query {
    commutings {
       timestamp
       distance
       co2e
       transportationMode
  }
}

Heating

query {
    heatings {
       timestamp
       co2e
       fuelType
  }
}

Electricity

query {
    electricities {
       timestamp
       co2e
       fuelType
  }
}

The email of the creating user of the electricity and heating entries would be the email of the representative I guess.