38
xyl0o
7y

Task:
- Replace a 4 year old PHP API.
Old API:
- PHP script writing PHP scripts to /var/www/ for every endpoint needed
- Answers everthing with 200 (not even 404)
DB:
- MySQL 5.6
- ~ 1000 Tables, NO FUCKING FK's
Documentation:
- "Wasn't worth the effort"
New API:
- Not allowed to behave any different
.
.
.
😭

Comments
  • 3
    Oh damn! I'm speechless here
  • 6
    Make a wrapper, and hand it over. Fuck the client with inexplicable and unrealistic requirements.
  • 3
    @notSoSerious if i had a client. Im a working student.
  • 1
    So basically a catch-all route that builds table name from Uri segments and returns 200 aka everything is fine, move along
  • 0
    oh god... no words... jus why?
  • 4
    Copy paste the API but change so it answers 404 to everything even if it's fine.

    I like to watch the world burn
  • 0
    @ClemFrieckie i have to run next door and ask where to join this id. And just for the lulz no consistent naming scheme
  • 1
    So just why do it?
    They Seem to have an API that works. So why replace the old one if the API is not allowed to change? :)
  • 0
    @ClemFrieckie Active record style? Zero joins, just requery the next table using a where in or where exists clause.

    I really dislike it, but it's quite popular in Ruby on Rails and Laravel — and for straightforward crud APIs where every endpoint refers to one table it usually works. Until you need to do complex statistical queries...
  • 0
    @ebroda the old one does not scale - obviously

    No pooling, no caching, no orm whatsoever. Just a pile of 50 line PHP scripts.
  • 2
    A PHP script that outputs PHP scripts? Whoa, meta.
  • 0
    Even as a student there is a time to stand up and fight! It's your time to shine tell them you can do better
  • 0
    Juste leave it as it is tell your client that you enhanced the code structure
  • 0
    No FORIEGN KEYS?
  • 2
    whenever I get upset with the OScommerce1-mutant-frankenkrakken which I've inherited, I remind myself that someone has it worse.

    Today, you are that someone.
  • 0
    API v2?
  • 1
    @valium123 Its almost like wordpress
Add Comment