Commit Graph

19 Commits (4127f923aa174ecebed93898dd39c1b21b6b2605)

Author SHA1 Message Date
Aravinth Manivannan d948730110
feat: render markdown comments 2022-04-06 11:31:39 +05:30
Aravinth Manivannan 31f2c6960a
feat: render markdown files in gists 2022-04-06 11:02:33 +05:30
Aravinth Manivannan 2d06e7fa39
fix: delete all gist repositories when account is deleted 2022-03-24 19:32:51 +05:30
Aravinth Manivannan 13388326ef
chore & fix: modularize templates and fix multi-file gists for the final
time.
2022-03-14 13:57:32 +05:30
Aravinth Manivannan 95efab95da
feat: load comments in gists view route and comment form 2022-03-13 17:34:18 +05:30
Aravinth Manivannan 2323dbf82c
feat: gist view 2022-03-12 18:16:42 +05:30
Aravinth Manivannan 2db966c04a
feat: gist index view 2022-02-28 12:18:49 +05:30
Aravinth Manivannan edca78906e
feat: gist preview
SUMMARY
    crate::data::Data::gist_preview fetches gist metadata from DB and
    retrieves contents of all the files(see notes #1) stored in the
    repository

NOTES
    1) Data::gist_preview uses Data::read_file under the hood, which
       currently reads subdirectories up to level 1 depth. Decision has
       to be made regarding what to do with level 2 and below
       subdirectories. TODO
2022-02-28 10:38:13 +05:30
Aravinth Manivannan 5791e829fd
feat: utility method to parse gist public ID from repo path 2022-02-28 10:36:00 +05:30
Aravinth Manivannan 375bdc1e6c
chore: use references to GistID whenever possible 2022-02-28 10:34:26 +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 b7fe7ea5d5
chore: rename gists to gitpad 2022-02-20 19:21:28 +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 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 82acb06eac
feat: Data::write_file accepts gist ID/gist repository & test cleanup 2022-02-15 23:46:31 +05:30
Aravinth Manivannan 18865552e1
feat: Data::write_file and Data::read_file to save and read gists
SUMMARY
    Data::write_file
	Creates a new files and commits them to "master" branch on the
	bare repository allocated for the gist. If multiple files are
	supplied, all files are written and committed in a single
	commit.

	Currently, empty commit message is used but this should probably
	be changed.

	If filename includes spaces it is escaped. Example "foo bar".txt
	is escaped and converted into "foo\ bar".txt.

    Data::read_file
	Reads files already committed to the repository allocated for
	the gist. This method expects filenames provided to be already
	escaped. Failure would result in file not found errors

    Data::get_repository_path
	Receives gist public ID and returns path of the repository
	allocated for the gist. Programmers are expected to use this
	method to work on the repositories instead of manually
	constructing paths.

    crate::utils::escape_spaces
	Escapes spaces in the provided string, "foo bar".txt is
	converted to "foo\ bar".txt
2022-02-15 21:29:55 +05:30
Aravinth Manivannan 303a4ab0ba
feat: helper method Data::new_gist to create new gist and tests
DESCRIPTION
    Data::new_gist creates a bare repository in the supplied
    Data.settings.repository.root directory and saves metadata in the
    database

    See accompanying test for usage
2022-02-14 22:46:17 +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