Commit Graph

9 Commits (4127f923aa174ecebed93898dd39c1b21b6b2605)

Author SHA1 Message Date
Aravinth Manivannan f5a22a2916
fix: add validation to check for empty file array during gist creation 2022-02-23 20:32:32 +05:30
Aravinth Manivannan 8901191549
feat: empty homepage placeholder 2022-02-22 10:07:52 +05:30
Aravinth Manivannan 9dd7f2e1c7
chore: rm errors.rs from coverage report and cleanup protected_routes_work 2022-02-21 02:18:44 +05:30
Aravinth Manivannan b85ef1d531
chore: use constants to convert ServiceError to StatusCode 2022-02-20 01:03:25 +05:30
Aravinth Manivannan b58a2fcee0
feat: REST endpoint to post comment on gist
SUMMARY
    Comment on gist and  utilities to generate post comment REST
    endpoint route from username and gist public ID component

ERRORS
    - Gist doesn't exist, 404 GistNotFound is returned
    - Gist is private and commenting user is not ower, 404 GistNotFound
      is returned
    - Comment is empty, 400 EmptyComment is returned
2022-02-18 23:52:21 +05:30
Aravinth Manivannan bcb3545f8f
feat: utils: ErrorToResponse implements Debug and get_request accepts cookies 2022-02-18 22:53:28 +05:30
Aravinth Manivannan 303a430113
fix: rename GistPrivacy to GistVisibility and *privacy to *visibility 2022-02-14 20:38:19 +05:30
Aravinth Manivannan 6b60e2a064
feat: add gists_gists, gists_comments and gists_comments & related methods
The following changes are implemented for both db-sqlx-postgres and
db-sqlx-sqlite:

TABLE gists_gists
    Stores gist metadata with unique index on gists_gists.public_id for fast
    lookups

TABLE gists_comments
    Stores comment metadata

TABLE gists_privacy
    Stores gist privacy: sqlx currently doesn't have support Postgres
    enums(ref: https://github.com/launchbadge/sqlx/issues/1171), so storing
    possible privacy values as references from this table.

    This table shouldn't be mutated during runtime. Possible values are
    already recorded in database during migrations. All runtime operations
    on this table must only take references.

    Each implementation of GistDatabase also includes a method called
    privacy_exists, which is called during tests to ensure that
    migrations are successful.

VIEW gists_gists_view
    Gist lookups combines data from gists_users, gists_gists and
    gists_privacy. This SQL view boots performance(I think?). At any rate,
    it is much nicer to work with.

QUIRKS
    Database indexes are i64 in SQLite while i32 in Postgres
2022-02-14 20:11:26 +05:30
Aravinth Manivannan 34a67a5535 feat: bootstarp gists
AUTHENTICATION

- Sign Up
- Sign IN

ACCOUNT
- Username Exists
- Email Exists
- Account delete
- Password update
- Email update
- Username update
- Get account secret
- Update secret

All routes are implemented with proper error handling and testing

CONFIGURATION
See ./config/default.toml for full list
2022-02-12 23:48:35 +05:30