pledge4future / WePledge

WebApp to calculate work related CO2e emissions from heating and electricity consumption as well as business trips and commuting.
https://pledge4future.org
GNU General Public License v3.0
6 stars 2 forks source link

Endpoint for overview of emission entries #248

Open codingfabi opened 1 year ago

codingfabi commented 1 year ago

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
redfrexx commented 1 year ago

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.