┌──────────────────────────┐ ┌───────────────────────────┐
│ User Schema │ │ Shortcuts │
├────────────┬─────────────┤ ├─────────────┬─────────────┤
│ id │ uuid ├─1─────┐ │ id │ uuid │
│ first_name │ varchar │ └──*──┤ user_id │ uuid │
│ last_name │ varchar │ │ short_link │ varchar │
│ email │ varchar │ │ description │ varchar │
│ password │ varchar │ │ source_url │ varchar │
│ created_at │ timestamptz │ │ tags │ varchar[] │
│ │ │ │ created_at │ timestamptz │
└────────────┴─────────────┘ └─────────────┴─────────────┘
Note:
- The id fields are the primary keys
- email field in users table & short_link field in shortcuts table are unique
- created_at has a default value set to
now
- I've used yarn for package management but you can use npm as well. Just make sure to delete the
yarn.lock
file before installing packages with npm. - The integration tests can be ran with
yarn test or npm run test
command. yarn start or npm run start
command starts the server. Once the server is started, you can query the graphql endpoints onhttp://localhost:6900/graphql