WeightliftingNZ / lifter-api-wrapper

This is an Python wrapper for the Lifter API
https://weightliftingnz.github.io/lifter-api-wrapper
MIT License
1 stars 0 forks source link

Adding checks #15

Open shivan-s opened 2 years ago

shivan-s commented 2 years ago

Is your feature request related to a problem? Please describe. It will be nice to add checks (e.g. checking if there is a competition on the same date or athlete with the same name, or if a lift already exists in the competition.

Describe the solution you'd like Before creating a competition, athlete, or lift - check if this already exists.

e.g. for a lift

def create_lift(self, athlete_id, competition_id):
    if athlete_id in [lift['athlete'] for athlete in self.lifts(competition_id=competition_id)]:
       return {"detail": "Athlete already in competition"}
    ...

Describe alternatives you've considered Writing abstracted code using the api components.