DoSomething / bertly

🔗 A serverless link shortener.
https://dosome.click/wq544
MIT License
2 stars 1 forks source link

Add Link model & "create link" endpoint. #59

Closed DFurnes closed 4 years ago

DFurnes commented 4 years ago

What's this PR do?

This pull request adds a "create link" endpoint, based on Bertly's existing POST / endpoint.

How should this be reviewed?

I've added the Dynamoose (DynamoDB) model in 2919e2f. This sets up our database schema, indexes, and some database settings (could maybe extract if we ever add more models).

I then added the POST / endpoint & a functional test in 2371773. The most interesting thing here is how this creates unique short-links and partitions the counter to avoid a single "hot" key.

Any background context you want to provide?

I still need to set up validation & authentication but will tackle that later on.

I'll push up PRs for the other endpoints once this is merged (since they need Link too).

Relevant tickets

References Pivotal #172799437.

Checklist

sheyd commented 4 years ago

Every time I read Dynamoose, I can't help but think of this.

image