Commit Graph

25 Commits (8f2a8ed1a18a0fcf1398001799a6ea6c7d59f208)

Author SHA1 Message Date
Aravinth Manivannan 2db966c04a
feat: gist index view 2022-02-28 12:18:49 +05:30
Aravinth Manivannan 375bdc1e6c
chore: use references to GistID whenever possible 2022-02-28 10:34:26 +05:30
Aravinth Manivannan 9e15e04ca5
feat: new gist page and extractors to handle new gist form payload
SUMMARY
    REST API for gist creation uses JSON for payload format, which
    supports array. Form doesn't so gist file field names(filename and
    content) follow {KNOWN_PREFIX}{index} semantics, which can be parsed
    while processing request.
2022-02-23 20:34:24 +05:30
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 037b7f1b97
feat: HTTP signout route 2022-02-21 23:41:56 +05:30
Aravinth Manivannan 58fbe892b3
chore: separate API logout route 2022-02-21 23:38:02 +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 604d887164
feat: REST endpoint to delete comment by ID
DESCRIPTION
    Each comment is uniquely identified by database assigned, serially
    incremented ID. Access controlled REST endpoint is added to delete
    comment by ID.

ERRORS RETURNED
    - Gist doesn't exist: 404 GistNotFound
    - Gist is private and requesting user is not owner or is not visible
      to user: 404 GistNotFound
    - Gist exists and is visible to requesting user but comment doesn't
      exist: 404 CommentNotFound
    - Gist exists and is visible to requesting user is not comment owner
      : 401 UnauthorizedOperation
2022-02-20 01:04:13 +05:30
Aravinth Manivannan 043211a357
feat: REST endpoint to get all comments on a gist
DESCRIPTION
    Get all comments on a gist. Access controlled but optionally
    authenticated HTTP REST endpoint is added to get comment by ID.

ERRORS RETURNED
    - Gist doesn't exist: 404 GistNotFound
    - Gist is private and requesting user is not owner or is not
      authenticated: 404 GistNotFound
2022-02-19 23:52:38 +05:30
Aravinth Manivannan f8b9172b88
feat: REST endpoint to get comment by ID
DESCRIPTION
    Each comment is uniquely identified by database assigned, serially
    incremented ID. Access controlled but optionally authenticated HTTP
    REST endpoint is added to get comment by ID.

ERRORS RETURNED
    - Gist doesn't exist: 404 GistNotFound
    - Gist is private and requesting user is not ower or is not
      authenticated: 404 GistNotFound
    - Comment is empty: 400 EmptyComment
    - Gist exists and is visible to requesting user but comment doesn't
      exist: 404 CommentNotFound
2022-02-19 23:01:29 +05:30
Aravinth Manivannan 7fce5302e1
feat: get_comment route and tests for all path builder methods on Gist 2022-02-19 21:52:27 +05:30
Aravinth Manivannan c58a6f1fae
feat: REST endpont return comment ID after creation 2022-02-19 21:41:30 +05:30
Aravinth Manivannan 96be68c734
fix and chore: apply clippy lints and create_gist returns gist public ID
fixes #1
2022-02-19 13:35:03 +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 91be25d9f6
fix: serve get_file under contents/ 2022-02-18 23:12:52 +05:30
Aravinth Manivannan a8718dc73e
feat: REST endpoint to read file in gist repository
SUMMARY
    Optionally authenticated endpoint to read file in gist repository.
    Subject to gist visibility.

DESCRIPTION
    crate::api::v1::gists::read_file
	- Parses URI for gist owner, gist public ID and file path.
	- Contents of gists with private visibility are only returned
	  to owner of gists. Identity determined using session cookies.
	- Contents are Unlisted and Public visibility gists are
	  accessible by both unauthenticated and authenticated
	  users(authenticated but not owner).
2022-02-18 22:55:01 +05:30
Aravinth Manivannan 3b4d944291
feat: Gist::get_file_route utility method to substitute values in get file routes 2022-02-18 22:54:22 +05:30
Aravinth Manivannan 632fe272fa
feat: read_file processes directories
SUMMARY
    This program supports directories in gists. This patch modifies
    Data::read_file to support directory reads. Additionally,
    CreateGistRequest is modified to accept files in subdirectories.

DESCRIPTION
    Data::read_file
	When repository contains subdirectories, it will recursively
	read all files and return their contents.

    crate::data::api::v1::gists::GitFileMode
	Set of known(to me) file modes that Git uses.
	GitFileMode::Unsupported is used to take advantage of
	num_enum::FromPrimitive. The alternative would have been
	num_enum::TryFromPrimitive, which returns errors on unsupported
	values. I felt the former was cleaner.
2022-02-18 21:38:38 +05:30
Aravinth Manivannan 197950c3b2
feat: accommodate binary file content
SUMMARY
    Binary content is essential to store images. ContentType enum
    accommodates both utf-8 and and non utf-8 encodings.

    Data::write_file and Data::read_file are modified to handle
    ContentType enum
2022-02-16 20:23:04 +05:30
Aravinth Manivannan 7cdfcc47bb
feat: HTTP JSON endpoint to create new gist 2022-02-15 23:48:05 +05:30
Aravinth Manivannan c636826ecf
fix: cargo fmt 2022-02-14 22:42:02 +05:30
Aravinth Manivannan 9c35c6f99b
feat: add tests for health meta route 2022-02-13 16:27:42 +05:30
Aravinth Manivannan 915fb46445 fix: lints and run migrations before generating coverage in CI 2022-02-13 00:07:28 +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