Skip to content

Commit

Permalink
Merge pull request breatheco-de#973 from jefer94/feature/schema-link
Browse files Browse the repository at this point in the history
Add schema link and signature
  • Loading branch information
tommygonzaleza authored Aug 9, 2023
2 parents e831f65 + cb2a894 commit dbb58d7
Show file tree
Hide file tree
Showing 50 changed files with 3,889 additions and 216 deletions.
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ docs="mkdocs serve --livereload"
generate_docs="mkdocs build"
doctor="python -m scripts.doctor"
docs_deploy="mkdocs gh-deploy -c"
sign_jwt="python manage.py sign_jwt"
sign_request="python manage.py sign_request"

[dev-packages]
pytest-cov = "*"
Expand Down
140 changes: 50 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<h1 align="center">
<br>
<a href="https://breatheco.de/"><img src="https://assets.breatheco.de/apis/img/images.php?blob&random&cat=icon&tags=breathecode,128" alt="BreatheCode" width="128"></a>
<br>
BreatheCode
<a href="https://breatheco.de/"><img src="https://raw.githubusercontent.com/breatheco-de/apiv2/main/breathecode/static/assets/logo.png" alt="4Geeks" width="128"></a>
<br>
</h1>

<h4 align="center">BreatheCode's mission is to <b>accelerate the way junior developers learn and evolve</b> using technology.</h4>
<h4 align="center">4Geeks's mission is to <b>accelerate the way junior developers learn and evolve</b> using technology.</h4>

<p align="center">
<a href="https://coveralls.io/github/breatheco-de/apiv2">
Expand Down Expand Up @@ -43,111 +41,95 @@ Check out the [Postman docs](https://documenter.getpostman.com/view/2432393/T1LP

The documentation is divided into several sections:

- [No Installation (with gitpod)](#working-inside-gitpod-no-instalation)
- [How to work Gitpod](#how-to-work-gitpod)
- [Add the browser extension](#add-the-browser-extension)
- [How to use Gitpod browser extension](#how-to-use-gitpod-browser-extension)
- [Installation inside Docker (easier)](#working-inside-docker-easier)
- [Build BreatheCode Dev docker image](#build-breathecode-dev-docker-image)
- [Testing inside BreatheCode Dev](#testing-inside-breathecode-dev)
- [Run BreatheCode API as docker service](#run-breathecode-api-as-docker-service)
- [Installation in your local machine (a bit harder but more performant)](#working-in-your-local-machine-recomended)
- [Installation in your local machine](#installation-in-your-local-machine)
- [Testing in your local machine](#testing-in-your-local-machine)
- [Run BreatheCode API in your local machine](#run-breathecode-api-in-your-local-machine)

## Working inside Gitpod (no installation)

### `How to work Gitpod`

Creating a workspace is as easy as prefixing any GitHub URL with `gitpod.io/#`.
- [Run 4Geeks in Codespaces (no installation)](#run-4geeks-in-codespaces-no-instalation)
- [Install Docker](#install-docker)
- [Run 4Geeks API as docker service](#run-4geeks-api-as-docker-service)
- [Run 4Geeks in your local machine](#run-4geeks-api-in-your-local-machine)
- [Installation](#installation)
- [Run 4Geeks API](#run-4geeks-api)
- [Run tests](#run-tests)

### `Add the browser extension`
## Run 4Geeks in Codespaces (no installation)

Gitpod provide the extension for:
Click `Code` -> `Codespaces` -> `Create namespace on {BRANCH_NAME}`.

- [Chrome](https://chrome.google.com/webstore/detail/gitpod-online-ide/dodmmooeoklaejobgleioelladacbeki) - also works for Edge, Brave and other Chromium-based browsers.
- [Firefox](https://addons.mozilla.org/firefox/addon/gitpod/)
![Codespaces](docs/images/codespaces.png)

### `How to use Gitpod browser extension`
## Install Docker

For convenience, Gitpod developed a Gitpod browser extension. It adds a button to GitHub, GitLab or Bitbucket that does the prefixing for you - as simple as that.
Install [docker desktop](https://www.docker.com/products/docker-desktop) in your Windows, else find a guide to install Docker and Docker Compose in your linux distribution `uname -a`.

![How to use gitpod extension](https://www.gitpod.io/images/docs/browser-extension-lense.png)
## Running 4geeks

## Working inside Docker (easier)
### `Run 4Geeks API as docker service`

### `Build BreatheCode Dev docker image`
```bash
# open 4Geeks API as a service and export the port 8000
docker-compose up -d

For mac and pc users install [docker desktop](https://www.docker.com/products/docker-desktop), else, for linux find a guide to install Docker and Docker Compose in your linux distribution `uname -a`.
# create super user
sudo docker compose run 4geeks python manage.py createsuperuser

```bash
# Check which dependencies you need install in you operating system
python -m scripts.doctor
# See the output of Django
docker-compose logs -f 4geeks

# Generate the BreatheCode Dev docker image
docker-compose build bc-dev
# open localhost:8000 to view the api
# open localhost:8000/admin to view the admin
```

### `Testing inside BreatheCode Dev`
### `Run 4Geeks in your local machine`

```bash
# Open the BreatheCode Dev, this shell don't export the port 8000
docker-compose run bc-dev fish
#### Installation

# Testing
pipenv run test ./breathecode/activity # path

# Testing in parallel
pipenv run ptest ./breathecode/activity # path
```bash
# Check which dependencies you need install in your operating system
python -m scripts.doctor

# Coverage
pipenv run cov breathecode.activity # python module path
# Setting up the redis and postgres database, you also can install manually in your local machine this databases
docker-compose up -d redis postgres

# Coverage in parallel
pipenv run pcov breathecode.activity # python module path
# Install and setting up your development environment (this command replace your .env file)
python -m scripts.install
```

### `Run BreatheCode API as docker service`
#### Run 4Geeks API

You must up Redis and Postgres before open 4Geeks.

```bash
# open BreatheCode API as a service and export the port 8000
docker-compose up -d bc-dev
# Collect statics
pipenv run python manage.py collectstatic --noinput

# open the BreatheCode Dev, this shell don't export the port 8000
docker-compose run bc-dev fish
# Run migrations
pipenv run python manage.py migrate

# create super user
pipenv run python manage.py createsuperuser
# Load fixtures (populate the database)
pipenv run python manage.py loaddata breathecode/*/fixtures/dev_*.json

# Close the BreatheCode Dev
exit
# Create super user
pipenv run python manage.py createsuperuser

# See the output of Django
docker-compose logs -f bc-dev
# Run server
pipenv run start

# open localhost:8000 to view the api
# open localhost:8000/admin to view the admin
```

## Working in your local machine (recommended)

### `Installation in your local machine`
### `Testing in your local machine`

Install [docker desktop](https://www.docker.com/products/docker-desktop) in your Windows, else find a guide to install Docker and Docker Compose in your linux distribution `uname -a`.
#### Installation

```bash
# Check which dependencies you need install in your operating system
python -m scripts.doctor

# Setting up the redis and postgres database, you also can install manually in your local machine this databases
docker-compose up -d redis postgres

# Install and setting up your development environment (this command replace your .env file)
python -m scripts.install
```

### `Testing in your local machine`
#### Run tests

```bash
# Testing
Expand All @@ -162,25 +144,3 @@ pipenv run cov breathecode.activity # python module path
# Coverage in parallel
pipenv run pcov breathecode.activity # python module path
```

### `Run BreatheCode API in your local machine`

```bash
# Collect statics
pipenv run python manage.py collectstatic --noinput

# Run migrations
pipenv run python manage.py migrate

# Load fixtures (populate the database)
pipenv run python manage.py loaddata breathecode/*/fixtures/dev_*.json

# Create super user
pipenv run python manage.py createsuperuser

# Run server
pipenv run start

# open localhost:8000 to view the api
# open localhost:8000/admin to view the admin
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 3.2.20 on 2023-08-05 03:23

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('admissions', '0058_alter_cohort_available_as_saas'),
]

operations = [
migrations.AlterField(
model_name='cohortuser',
name='history_log',
field=models.JSONField(
blank=True,
default=dict,
help_text=
'The cohort user log will save attendancy and information about progress on each class'),
),
]
2 changes: 1 addition & 1 deletion breathecode/admissions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def __init__(self, *args, **kwargs):
default=False, help_text='You can active students to the watch list and monitor them closely')

history_log = models.JSONField(
default=dict(),
default=dict,
blank=True,
null=False,
help_text='The cohort user log will save attendancy and information about progress on each class')
Expand Down
22 changes: 22 additions & 0 deletions breathecode/assignments/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from breathecode.assignments.actions import task_is_valid_for_notifications, NOTIFICATION_STRINGS
import breathecode.notify.actions as actions
from breathecode.utils.service import Service
from .models import Task

# Get an instance of a logger
Expand Down Expand Up @@ -115,4 +116,25 @@ def serialize_task(task):
cohort_user.history_log = user_history_log
cohort_user.save()

s = None
try:
if hasattr(task.user, 'credentialsgithub') and task.github_url:
s = Service('rigobot', task.user.id)

if s and task.task_status == 'DONE':
s.post('/v1/finetuning/me/repository/',
json={
'url': task.github_url,
'watchers': task.user.credentialsgithub.username,
})

elif s:
s.put('/v1/finetuning/me/repository/',
json={
'url': task.github_url,
'activity_status': 'INACTIVE',
})
except:
logger.error('App Rigobot not found')

logger.info('History log saved')
Loading

0 comments on commit dbb58d7

Please sign in to comment.