Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: better setup tutorial #36

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "cira-backend"
name = "cira"
version = "0.1.0"
edition = "2021"

Expand Down
99 changes: 56 additions & 43 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
> Warning: You should probably not use this in production or with any data that is sensitive as the authentication system
> Warning: You should probably not use this in production or with any data that is sensitive as the authentication
> system
> is made very amateurish.

# Cira - a minimalistic ticket system backend
Expand All @@ -11,48 +12,56 @@ The rest is up to you.
Create a native desktop or smartphone app, or keep in the web as most ticket boards to.
You decide, the possibilities are endless.


## Features

Cira gives you the foundation to:

- create and delete tickets
- update tickets after creation
- group tickets by labels
- assign tickets to users
- filter tickets by labels, assignee, status and labels
- authentication with bearer tokens


## Run Locally

Simply clone the repository, set up the database and compile the application locally.
Then start it.
You are required to have installed: [the rust programming language](https://rust-lang.org),
[git](https://git-scm.com/), [diesel](https://diesel.rs)
[git](https://git-scm.com/), [diesel](https://diesel.rs), [sqlite](https://www.sqlite.org/)

```bash
git clone https://github.com/CodeF0x/cira-backend.git
cd cira-backend
git clone https://github.com/CodeF0x/cira.git
cd cira
cargo install diesel_cli --no-default-features --features "sqlite"
diesel setup
cargo build --release
./target/release/<name of executable>
./target/release/cira
```

If you're on Debian and get `error: linking with 'cc' failed: exit status: 1`, make sure to have `build-essential`
installed. Same goes for other distros (build-essential might be called different / have an equivalent).

If this error accours while installing `diesel_cli`, try `sudo apt install -y libsqlite3-dev libpq-dev libmysqlclient-dev`.

There are some default values set in the .env file, you can adjust them as you wish.
Keep in mind to change the code as well.
Keep in mind to change the code as well. For example, if you change the database file name, change it in the .env file
as well.

You can also launch it in a screen or in a container, so it runs without an active shell session.
If everything went well and there is no output after running the last command, cira is listening on port `8080`.

You can also launch it in a screen or in a container, so it runs without an active shell session.

## Running Tests

To run tests, set up a fake database that is independent of the actual production database.
You need to have installed [diesel](https://diesel.rs), and [rust](https://rust-lang.org).
You need to have installed [diesel](https://diesel.rs), [sqlite](https://www.sqlite.org/) and [rust](https://rust-lang.org).

```bash
diesel migration run --database-url test-backend.sqlite
cargo test
```


## API Reference

#### Create a new ticket
Expand All @@ -63,19 +72,21 @@ cargo test

Your payload must be valid JSON and contain the following properties:

| Property | Type | Description |
| :-------- | :------- | :------------------------- |
| `title` | `string` | **Required**. The title of your ticket |
| `body` | `string` | **Required**. The body of your ticket |
| `labels` | `Array<string>` | **Required**. Labels of your ticket |
| `status` | `string` | **Required**. The status of your ticket (set it to "Open") |
| `assigned_user` | `id \| null` | **Optional**. A user the ticket should be assigned to. Can be omitted or null |
| Property | Type | Description |
|:----------------|:----------------|:------------------------------------------------------------------------------|
| `title` | `string` | **Required**. The title of your ticket |
| `body` | `string` | **Required**. The body of your ticket |
| `labels` | `Array<string>` | **Required**. Labels of your ticket |
| `status` | `string` | **Required**. The status of your ticket (set it to "Open") |
| `assigned_user` | `id \| null` | **Optional**. A user the ticket should be assigned to. Can be omitted or null |

Possible Status options:

- `Open`
- `Closed`

Possible Label options:

- `Feature`
- `Bug`
- `WontFix`
Expand All @@ -100,9 +111,9 @@ Get all tickets.

URL parameters:

| Property | Type | Description |
| :-------- | :------- | :------------------------- |
| `id` | `number` | **Required**. The id of the ticket |
| Property | Type | Description |
|:---------|:---------|:-----------------------------------|
| `id` | `number` | **Required**. The id of the ticket |

Deletes a ticket and returns it.

Expand All @@ -114,25 +125,27 @@ Deletes a ticket and returns it.

URL parameters:

| Property | Type | Description |
| :-------- | :------- | :------------------------- |
| `id` | `number` | **Required**. The id of the ticket |
| Property | Type | Description |
|:---------|:---------|:-----------------------------------|
| `id` | `number` | **Required**. The id of the ticket |

Your payload must be valid JSON and contain the following properties:

| Property | Type | Description |
| :-------- | :------- | :------------------------- |
| `title` | `string` | **Required**. The title of your ticket |
| `body` | `string` | **Required**. The body of your ticket |
| `labels` | `Array<string>` | **Required**. Labels of your ticket |
| `status` | `string` | **Required**. The status of your ticket (set it to "Open") |
| `assigned_user` | `id \| null` | **Optional**. A user the ticket should be assigned to. Can be omitted or null |
| Property | Type | Description |
|:----------------|:----------------|:------------------------------------------------------------------------------|
| `title` | `string` | **Required**. The title of your ticket |
| `body` | `string` | **Required**. The body of your ticket |
| `labels` | `Array<string>` | **Required**. Labels of your ticket |
| `status` | `string` | **Required**. The status of your ticket (set it to "Open") |
| `assigned_user` | `id \| null` | **Optional**. A user the ticket should be assigned to. Can be omitted or null |

Possible Status options:

- `Open`
- `Closed`

Possible Label options:

- `Feature`
- `Bug`
- `WontFix`
Expand All @@ -149,11 +162,11 @@ Updates a ticket and returns it.

Your payload must be valid JSON and contain the following properties:

| Property | Type | Description |
| :-------- | :------- | :------------------------- |
| `display_name` | `string` | **Required**. The user's display name |
| `email` | `string` | **Required**. The user's email address |
| `password` | `string` | **Required**. The user's password |
| Property | Type | Description |
|:---------------|:---------|:---------------------------------------|
| `display_name` | `string` | **Required**. The user's display name |
| `email` | `string` | **Required**. The user's email address |
| `password` | `string` | **Required**. The user's password |

Create a new user and return it.

Expand All @@ -165,22 +178,22 @@ Create a new user and return it.

Your payload must be valid JSON and contain the following properties:

| Property | Type | Description |
| :-------- | :------- |:----------------------------------------------------------------|
| `title` | `string \| null` | **Optional**. Title to search for. Can be omitted or null |
| `labels` | `Array<string> \| null` | **Optional**. Labels to search for. Can be omitted or null |
| `status` | `string \| null` | **Optional**. Status to search for. Can be omitted or null |
| `assigned_user` | `id \| null` | **Optional**. Assignee id to search for. Can be omitted or null |
| Property | Type | Description |
|:----------------|:------------------------|:----------------------------------------------------------------|
| `title` | `string \| null` | **Optional**. Title to search for. Can be omitted or null |
| `labels` | `Array<string> \| null` | **Optional**. Labels to search for. Can be omitted or null |
| `status` | `string \| null` | **Optional**. Status to search for. Can be omitted or null |
| `assigned_user` | `id \| null` | **Optional**. Assignee id to search for. Can be omitted or null |

Lets you filter for tickets and return results.

## Contributing

Contributions are always welcome!

Either by submitting issues, pull requests or just general constructive feedback in the form of issues,
emails or direct messages on Telegram.


## License

[MIT](https://choosealicense.com/licenses/mit/)
Expand Down
Loading