Skip to content

Commit

Permalink
Merge branch 'main' into frontend-swift
Browse files Browse the repository at this point in the history
Signed-off-by: Parsa Kargari <[email protected]>
  • Loading branch information
ParsaKargari authored Feb 12, 2024
2 parents bd07764 + fbe14d7 commit 27dfa33
Show file tree
Hide file tree
Showing 49 changed files with 6,250 additions and 1,525 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Continuous Integration

on:
pull_request:
branches:
- main
- dev

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: cd backend && npm install

- name: Lint
run: cd backend && npm run lint

build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: cd backend && npm install

- name: Build
run: cd backend && npm run build

test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: cd backend && npm install

- name: Test
run: cd backend && npm test
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ dist
migrations
Rethread/Rethread.xcodeproj/project.xcworkspace/xcuserdata/mortezafaraji.xcuserdatad/UserInterfaceState.xcuserstate
.vscode
**/GoogleService-Info.plist
**/GoogleService-Info.plist
.DS_Store
coverage
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 techstartucalgary

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
113 changes: 50 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# ♻️ ReThread

[![Continuous Integration](https://github.com/techstartucalgary/fashion/actions/workflows/ci.yml/badge.svg)](https://github.com/techstartucalgary/fashion/actions/workflows/ci.yml)
![GitHub repo size](https://img.shields.io/github/repo-size/techstartucalgary/rethread?logo=github&color=blue)
![Github tag](https://img.shields.io/github/v/tag/techstartucalgary/rethread?logo=github&color=red)
![GitHub contributors](https://img.shields.io/github/contributors/techstartucalgary/rethread?logo=github&color=yellow)
![Github pull requests](https://img.shields.io/github/issues-pr/techstartucalgary/rethread?logo=github)
![Github license](https://img.shields.io/github/license/techstartucalgary/rethread?logo=github&color=orange)

## 📖 Table of Contents

- [📝 Contributors](#-contributors)
- [👨‍💻 Teck Stack](#-tech-stack)
- [👨‍💻 Tech Stack](#-tech-stack)
- [🚀 Backend Documentation](#-backend-documentation)
- [🏃 Quickstart](#-quickstart)
- [🏃 Quick start](#-quick-start)
- [🛠️ Installation](#️-installation)
- [🧪 Testing](#-testing)
- [🚧 Development Environment](#-development-environment)
Expand All @@ -27,45 +34,34 @@
- [Anfaal]() - Backend Developer
- [Ryan]() - Backend Developer
- [Alison]() - Backend Developer

## 👨‍💻 Tech Stack

- Frontend

![Swift](https://img.shields.io/badge/Swift-F05138.svg?style=for-the-badge&logo=Swift&logoColor=white)
![SwiftUI](https://img.shields.io/badge/SwiftUI-2d68f3.svg?style=for-the-badge&logo=Swift&logoColor=black)
![Xcode](https://img.shields.io/badge/Xcode-1575F9.svg?style=for-the-badge&logo=Xcode&logoColor=white)
![Figma](https://img.shields.io/badge/Figma-F24E1E.svg?style=for-the-badge&logo=Figma&logoColor=white)

- Testing

![XCTest](https://img.shields.io/badge/XCTest-6ACD4D.svg?style=for-the-badge&logo=Apple&logoColor=white)
![Xcode](https://img.shields.io/badge/Xcode-1575F9.svg?style=for-the-badge&logo=Xcode&logoColor=white)

- Backend

![Typescript](https://img.shields.io/badge/TypeScript-3178C6.svg?style=for-the-badge&logo=TypeScript&logoColor=white)
![Node.js](https://img.shields.io/badge/Node.js-339933.svg?style=for-the-badge&logo=nodedotjs&logoColor=white)
![Express](https://img.shields.io/badge/Express-000000.svg?style=for-the-badge&logo=Express&logoColor=white)
![OpenAI](https://img.shields.io/badge/OpenAI-412991.svg?style=for-the-badge&logo=OpenAI&logoColor=white)
![Prisma](https://img.shields.io/badge/Prisma-2D3748.svg?style=for-the-badge&logo=Prisma&logoColor=white)
![MySQL](https://img.shields.io/badge/MySQL-4479A1.svg?style=for-the-badge&logo=MySQL&logoColor=white)
![Redis](https://img.shields.io/badge/Redis-DC382D.svg?style=for-the-badge&logo=Redis&logoColor=white)

- Testing

![Mocha](https://img.shields.io/badge/Mocha-8D6748.svg?style=for-the-badge&logo=Mocha&logoColor=white)
![Chai](https://img.shields.io/badge/Chai-A30701.svg?style=for-the-badge&logo=Chai&logoColor=white)

- CI/CD
![Node.js](https://img.shields.io/badge/Node.js-339933.svg?style=for-the-badge&logo=nodedotjs&logoColor=white)
![Prisma](https://img.shields.io/badge/Prisma-5a67d8.svg?style=for-the-badge&logo=Prisma&logoColor=white)
![MySQL](https://img.shields.io/badge/MySQL-3e6e93.svg?style=for-the-badge&logo=MySQL&logoColor=white)
![Zod](https://img.shields.io/badge/Zod-3E67B1.svg?style=for-the-badge&logo=Zod&logoColor=white)

![GitHub Actions](https://img.shields.io/badge/GitHub%20Actions-2088FF.svg?style=for-the-badge&logo=GitHub%20Actions&logoColor=white)
- Cloud

![PlanetScale](https://img.shields.io/badge/PlanetScale-000000.svg?style=for-the-badge&logo=PlanetScale&logoColor=white)

## 🚀 Backend Documentation

All the code is located in the `backend/src` directory. The backend is written using [Node.js](https://nodejs.org/en/) and [Express](https://expressjs.com/).

### 🏃 Quickstart
### 🏃 Quick start

1. Open the terminal and clone this repository using HTTPS or SSH (The example below uses SSH).

Expand All @@ -85,18 +81,6 @@ cd fashion
cd backend
```

4. Run `npm install --only=production` to install all the dependencies.

```bash
npm install
```

5. Run `npm run start` to start the server.

```bash
npm run start
```

### 🛠️ Installation

1. Make sure you have `Node.js` and `NPM` installed on your machine. Click [here](https://nodejs.org/en/) to download and install Node.js. Make sure you install the LTS version. NPM is installed automatically when you install Node.js.
Expand All @@ -115,25 +99,17 @@ npm -v

4. If you see the version number of `Node.js` and `npm` then you are good to go. If not, then try to reinstall `Node.js`.

5. Make sure you have `MySQL` installed on your machine. Click [here](https://dev.mysql.com/downloads/mysql/) to download and install MySQL. Make sure you install the latest version.

6. Open the terminal and run `mysql --version` to check if `MySQL` is installed.

```bash
mysql --version
```
5. Make sure you have `Docker Desktop` installed on your machine. Click [here](https://www.docker.com/products/docker-desktop) to download and install Docker Desktop. Make sure you install the latest version.

7. If you see the version number of `MySQL` then you are good to go. If not, then try to reinstall `MySQL`.
6. Make sure you have `Git` installed on your machine. Click [here](https://git-scm.com/downloads) to download and install Git. Make sure you install the latest version.

8. Make sure you have `Redis` installed on your machine. Click [here](https://redis.io/download) to download and install Redis. Make sure you install the latest version.

9. Open the terminal and run `redis-server --version` to check if `Redis` is installed.
7. Open the terminal and run `git -v` to check if `Git` is installed.

```bash
redis-server --version
git -v
```

10. If you see the version number of `Redis` then you are good to go. If not, then try to reinstall `Redis`.
8. If you see the version number of `Git` then you are good to go. If not, then try to reinstall `Git`.

### 🧪 Testing

Expand Down Expand Up @@ -189,18 +165,27 @@ cd backend
npm install
```

5. Run `npm run start` to start the server.
5. Run `npx prisma init` to initialize the database.

```bash
npm run dev
npx prisma init
```

6. Run `npx prisma studio` to open Prisma Studio and view the database schema (Optional).
6. Update your `prisma/schema.prisma` file within the `backend` folder to use the `mysql` provider and set the relation mode type to `prisma`.

```bash
npx prisma studio
```prisma
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
relationMode = "prisma"
}
```

7. Once you are ready to push your schema to PlanetScale, run `prisma db push` against your PlanetScale database to update the schema in your database.

```bash
npx prisma db push
```

# 🌟 Frontend Documentation

Expand All @@ -209,31 +194,33 @@ The frontend is crafted for iOS platforms, utilizing Swift and SwiftUI. The code
## 🏃 Quickstart

1. **Clone the Repository**:
```bash
git clone [email protected]:techstartucalgary/fashion.git
```

```bash
git clone [email protected]:techstartucalgary/fashion.git
```

2. **Navigate to the Frontend Directory**:
```bash
cd Rethread
```

```bash
cd Rethread
```

3. **Open the Project in Xcode**:
Open the project file `.xcodeproj` in Xcode.
Open the project file `.xcodeproj` in Xcode.

4. **Run the Application**:
Select an iOS simulator or connected device in Xcode and click 'Run'.
Select an iOS simulator or connected device in Xcode and click 'Run'.

## 🛠️ Setup and Installation

1. **Install Xcode**:
Ensure you have Xcode installed on your macOS, available through the Mac App Store.
Ensure you have Xcode installed on your macOS, available through the Mac App Store.

2. **Update Swift and SwiftUI**:
Ensure you have the latest version of Swift and SwiftUI installed, as they are crucial for frontend development.
Ensure you have the latest version of Swift and SwiftUI installed, as they are crucial for frontend development.

3. **Verify the Installation**:
Open Xcode and check for Swift and SwiftUI updates in the preferences.
Open Xcode and check for Swift and SwiftUI updates in the preferences.

4. **Minimum iOS Version**: This app is built for `iOS 16` and above.

Expand Down
22 changes: 22 additions & 0 deletions backend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-explicit-any": "warn"
}
}
21 changes: 0 additions & 21 deletions backend/.github/workflows/ci.yml

This file was deleted.

5 changes: 5 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
# Keep environment variables out of version control
.env
dist
coverage
15 changes: 15 additions & 0 deletions backend/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3"

services:
mysql:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: rethread
ports:
- "3306:3306"
volumes:
- mysql:/var/lib/mysql

volumes:
mysql:
19 changes: 19 additions & 0 deletions backend/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Config } from "jest";

const config: Config = {
preset: "ts-jest",
testEnvironment: "node",
verbose: true,
globals: {
"ts-jest": {
tsconfig: "tsconfig.json",
},
},
testMatch: ["<rootDir>/dist/**/*.test.js"],
coverageReporters: ["html"],
collectCoverage: true,
collectCoverageFrom: ["<rootDir>/dist/src/**/*.js"],
coverageDirectory: "<rootDir>/coverage",
};

export default config;
Loading

0 comments on commit 27dfa33

Please sign in to comment.