generated from trywilco/Anythink-Market-Public
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
WilcoApp
committed
Jan 22, 2025
1 parent
bfe9bae
commit 20266c5
Showing
129 changed files
with
6,623 additions
and
5,628 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,37 +9,23 @@ jobs: | |
timeout-minutes: 10 | ||
name: Pr checks | ||
|
||
services: | ||
postgres: | ||
image: postgres:13 | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
SECRET_KEY: secret | ||
POSTGRES_DB: anythink-market | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- name: Check out project | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Python | ||
uses: actions/setup-python@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
python-version: "3.9.13" | ||
node-version: "16" | ||
|
||
- uses: oNaiPs/secrets-to-env-action@v1 | ||
- name: Start MongoDB | ||
uses: supercharge/[email protected] | ||
with: | ||
secrets: ${{ toJSON(secrets) }} | ||
mongodb-version: "4.4" | ||
|
||
- name: Setup Node for Wilco Checks | ||
uses: actions/setup-node@v3 | ||
- uses: oNaiPs/secrets-to-env-action@v1 | ||
with: | ||
node-version: "16" | ||
secrets: ${{ toJSON(secrets) }} | ||
|
||
- name: Wilco checks | ||
id: Wilco | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,37 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
# Logs | ||
logs | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
.DS_Store | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
npm-debug.log* | ||
|
||
# pyenv | ||
.python-version | ||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Rope project settings | ||
.ropeproject | ||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# mkdocs documentation | ||
/site | ||
# Dependency directory | ||
node_modules | ||
|
||
# mypy | ||
.mypy_cache/ | ||
# Optional npm cache directory | ||
.npm | ||
|
||
.idea/ | ||
.vscode/ | ||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Project | ||
postgres-data | ||
.idea |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
FROM python:3.9.13 | ||
FROM node:16 | ||
|
||
ENV VIRTUAL_ENV=/opt/venv | ||
RUN python3 -m venv $VIRTUAL_ENV | ||
ENV PATH="$VIRTUAL_ENV/bin:$PATH" | ||
|
||
RUN pip install poetry==1.2.0 | ||
|
||
# Pre-install poetry packages | ||
WORKDIR /usr/src | ||
COPY backend ./backend | ||
COPY .wilco ./.wilco | ||
|
||
# Pre-install npm packages | ||
WORKDIR /usr/src/backend | ||
RUN poetry install | ||
RUN poetry export -f "requirements.txt" --without-hashes --with-credentials > "requirements.txt" | ||
RUN yarn install | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,22 @@ | ||
Web routes | ||
========== | ||
# Anythink Market Backend | ||
|
||
All routes are available on `/docs` or `/redoc` paths with Swagger or ReDoc. | ||
The Anythink Market backend is Node web app written with [Express](https://expressjs.com/) | ||
|
||
Project structure | ||
================= | ||
## Dependencies | ||
|
||
Files related to application are in the `app` or `tests` directories. Application parts are: | ||
- [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken) - For generating JWTs used by authentication | ||
- [mongoose](https://github.com/Automattic/mongoose) - For modeling and mapping MongoDB data to javascript | ||
- [mongoose-unique-validator](https://github.com/blakehaswell/mongoose-unique-validator) - For handling unique validation errors in Mongoose. Mongoose only handles validation at the document level, so a unique index across a collection will throw an exception at the driver level. The `mongoose-unique-validator` plugin helps us by formatting the error like a normal mongoose `ValidationError`. | ||
- [passport](https://github.com/jaredhanson/passport) - For handling user authentication | ||
- [slug](https://github.com/dodo/node-slug) - For encoding titles into a URL-friendly format | ||
|
||
app | ||
├── api - web related stuff. | ||
│ ├── dependencies - dependencies for routes definition. | ||
│ ├── errors - definition of error handlers. | ||
│ └── routes - web routes. | ||
├── core - application configuration, startup events, logging. | ||
├── db - db related stuff. | ||
│ ├── migrations - manually written alembic migrations. | ||
│ └── repositories - all crud stuff. | ||
├── models - pydantic models for this application. | ||
│ ├── domain - main models that are used almost everywhere. | ||
│ └── schemas - schemas for using in web routes. | ||
├── resources - strings that are used in web responses. | ||
├── services - logic that is not just crud related. | ||
└── main.py - FastAPI application creation and configuration. | ||
## Application Structure | ||
|
||
Project structure | ||
================= | ||
- `app.js` - The entry point to our application. This file defines our express server and connects it to MongoDB using mongoose. It also requires the routes and models we'll be using in the application. | ||
- `config/` - This folder contains configuration for passport as well as a central location for configuration/environment variables. | ||
- `routes/` - This folder contains the route definitions for our API. | ||
- `models/` - This folder contains the schema definitions for our Mongoose models. | ||
|
||
Project dependencies are managed by poetry (https://python-poetry.org), using venv (https://docs.python.org/3/library/venv.html). | ||
## Error Handling | ||
|
||
In `routes/api/index.js`, we define a error-handling middleware for handling Mongoose's `ValidationError`. This middleware will respond with a 422 status code and format the response to have [error messages the clients can understand](https://github.com/gothinkster/realworld/blob/master/API.md#errors-and-status-codes) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.