Skip to content

Commit

Permalink
Project readme (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
KeoFoxy authored Aug 5, 2024
1 parent 1f91ed1 commit ebf1ea5
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# :fox_face: swift-foxgres

Simple backend service that implements CRUD operations.

## Stack

* ***Swift***
* ***Vapor***
* ***Docker***
* ***PSQL***

## Requirements

* **[Swift 5.10](https://www.swift.org/download/)**
* **[Docker Desktop](https://www.docker.com/products/docker-desktop/)**

### Start

> [!IMPORTANT]
> Do not forget to create and fill the `.env` file! Just remove **.example** from `.env.example`
>
```sh
git clone git@github.com:KeoFoxy/swift-foxgres.git

docker-compose build
docker-compose up -d
docker-compose run migrate
```

### Tests

```sh
docker-compose up -d db

swift test
```

> [!WARNING]
> Make sure that the DB is available either via Docker or locally

#### API

##### Anime API

| Method | URL | Description |
| -------- | ---------------------------------------- | ---------------------------------------- |
| `GET` | `/animes` | Receive all anime. |
| `GET` | `/animes/{id}` | Get anime by id. |
| `POST` | `/animes` | Create an anime. |
| `PUT` | `/animes/{id}` | Update existing anime by id. |
| `DELETE` | `/animes/{id}` | Delete anime by id. |

##### Characters

| Method | URL | Description |
| -------- | ---------------------------------------- | ---------------------------------------- |
| `GET` | `/characters` | Receive all characters. |
| `GET` | `/characters/{id}` | Get character by id. |
| `POST` | `/characters` | Create character. |
| `PUT` | `/characters/{id}` | Update existing character by id. |
| `DELETE` | `/characters/{id}` | Delete character by id. |

#### Models

##### Anime
```swift
id: Optional<UUID>
titleEn: String
titleJp: String
description: Optional<String>
releaseDate: Date
rating: Double
episodeCount: Int
type: AnimeType
characters: [UUID]
genres: Optional<[String]>
imageUrl: Optional<String>
```

##### Character

```swift
id: Optional<UUID>
name: String
description: Optional<String>
animeId: [UUID]
imageUrl: Optional<String>
```

0 comments on commit ebf1ea5

Please sign in to comment.