Mazurco066 / band-manager-api

Playliter API
MIT License
2 stars 0 forks source link

[Backend] Add concert observations feature #1

Closed Mazurco066 closed 2 years ago

Mazurco066 commented 2 years ago

Briefing

Add a fields named "observations" on Concert schema to store a list of observations as the object below:

{
    ...
    observations: [
        {
            id: 'soma-id-here',
            title: 'Observation 01',
            data: 'Cool observations'
        },
        {
            id: 'soma-id-here',
            title: 'Observation 02',
            data: 'Awesoma observations'
        }
    ]
    ...
}

Then add 3 new endpoints:

Add observation

Input

{
    showId: string,
    title: string,
    data: string
}

Behavior

Update observation

Input

{
    id: string,
    showId: string,
    title: string,
    data: string
}

Behavior

Remove observation

Input

{
    showId: string,
    id: string
}

Behavior

Mazurco066 commented 2 years ago

Done, implemented 3 endpoints. Follow the examples below to call on graphql

Add observation

mutation {
  addObservation(AddObservationInput: {
    show: "e7bcffcf-c350-4130-baac-90012fa21806"
    title: "Selmo"
    data: "Salmo"
  }) {
    id
    title
    date
    songs
    band
    observations {
      id
      title
      data
    }
    createdAt
    updatedAt
  }
}

Update observation

mutation {
  updateObservation(UpdateObservationInput: {
    id: "085f0777-9226-4f72-9d2f-302a146f2993"
    show: "e7bcffcf-c350-4130-baac-90012fa21806"
    title: "Salmo Atualizado 2"
    data: "Salmo Atualizado 2"
  }) {
    id
    title
    date
    songs
    band
    observations {
      id
      title
      data
    }
    createdAt
    updatedAt
  }
}

Remove observartion

mutation {
  removeObservation(RemoveObservationInput: {
    id: "f2930549-7db7-4157-9a3c-c3b2c7042839"
    show: "e7bcffcf-c350-4130-baac-90012fa21806"
  }) {
    id
    title
    date
    songs
    band
    observations {
      id
      title
      data
    }
    createdAt
    updatedAt
  }
}