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

chore: rename project to backend #604

Merged
merged 1 commit into from
May 20, 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 .env.docker
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ EMAIL_HOST_USER="[email protected]"
EMAIL_HOST_PASSWORD="password"
# Django configurations
DJANGO_SECRET_KEY="some-secret"
DJANGO_SETTINGS_MODULE="bd_api.settings.local"
DJANGO_SETTINGS_MODULE="backend.settings.local"
# Logger
LOGGER_LEVEL="DEBUG"
LOGGER_IGNORE="faker,haystack"
Expand Down
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ EMAIL_HOST_USER="[email protected]"
EMAIL_HOST_PASSWORD="password"
# Django configurations
DJANGO_SECRET_KEY="some-secret"
DJANGO_SETTINGS_MODULE="bd_api.settings.local"
DJANGO_SETTINGS_MODULE="backend.settings.local"
# Logger
LOGGER_LEVEL="DEBUG"
LOGGER_IGNORE="faker,haystack"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
poetry run pytest \
--junitxml=pytest.xml \
--cov-report=term-missing:skip-covered \
--cov=bd_api bd_api | tee pytest-coverage.txt
--cov=backend backend | tee pytest-coverage.txt
- name: Report coverage
uses: MishaKav/pytest-coverage-comment@main
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
envFrom:
- secretRef:
name: api-development-secrets
settingsModule: "bd_api.settings.remote"
settingsModule: "backend.settings.remote"
database:
host: "cloud-sql-proxy"
port: 5432
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
envFrom:
- secretRef:
name: api-prod-secrets
settingsModule: "bd_api.settings.remote"
settingsModule: "backend.settings.remote"
database:
host: "cloud-sql-proxy"
port: 5432
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
envFrom:
- secretRef:
name: api-staging-secrets
settingsModule: "bd_api.settings.remote"
settingsModule: "backend.settings.remote"
database:
host: "cloud-sql-proxy"
port: 5432
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ fabric.properties

.vscode/
.DS_Store
/bd_api/media/
/bd_api/notebooks/
/bd_api/staticfiles/
/backend/media/
/backend/notebooks/
/backend/staticfiles/

# Fixture
fixtures*
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Copy app, generate static and set permissions
RUN /env/bin/python manage.py collectstatic --no-input --settings=bd_api.settings.base && \
RUN /env/bin/python manage.py collectstatic --no-input --settings=backend.settings.base && \
chown -R www-data:www-data /app

# Expose and run app
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ superuser_docker:
.PHONY: run_local
run_local:
@echo "Touching the log file to ensure it exists..."
@touch bd_api/django.log
@touch backend/django.log
@echo "Checking for model changes..."
@make migrations
@echo "Applying migrations..."
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from django.utils.translation import gettext_lazy
from faker import Faker

from bd_api.apps.account.models import Account, BDGroup, BDRole, Career, Subscription
from bd_api.apps.account.tasks import sync_subscription_task
from backend.apps.account.models import Account, BDGroup, BDRole, Career, Subscription
from backend.apps.account.tasks import sync_subscription_task


def sync_subscription(modeladmin: ModelAdmin, request: HttpRequest, queryset: QuerySet):
Expand Down
4 changes: 2 additions & 2 deletions bd_api/apps/account/apps.py → backend/apps/account/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@


class AccountConfig(AppConfig):
name = "bd_api.apps.account"
name = "backend.apps.account"
verbose_name = "Contas"
default_auto_field = "django.db.models.BigAutoField"

def ready(self):
import bd_api.apps.account.signals # noqa
import backend.apps.account.signals # noqa
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django import forms
from django.contrib.auth import get_user_model

from bd_api.apps.account.admin import AccountCreationForm
from backend.apps.account.admin import AccountCreationForm


class RegisterForm(AccountCreationForm):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from graphene import ID, Boolean, Mutation

from bd_api.apps.account.models import Account
from backend.apps.account.models import Account


class DeleteAccountPictureMutation(Mutation):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import django.db.models.deletion
from django.db import migrations, models

import bd_api.apps.account.models
import bd_api.apps.api.v1.validators
import bd_api.custom.storage
import backend.apps.account.models
import backend.apps.api.v1.validators
import backend.custom.storage


class Migration(migrations.Migration):
Expand Down Expand Up @@ -76,9 +76,9 @@ class Migration(migrations.Migration):
models.ImageField(
blank=True,
null=True,
storage=bd_api.custom.storage.OverwriteStorage(),
upload_to=bd_api.custom.storage.upload_to,
validators=[bd_api.custom.storage.validate_image],
storage=backend.custom.storage.OverwriteStorage(),
upload_to=backend.custom.storage.upload_to,
validators=[backend.custom.storage.validate_image],
verbose_name="Imagem",
),
),
Expand Down Expand Up @@ -170,7 +170,7 @@ class Migration(migrations.Migration):
"verbose_name_plural": "BD groups",
},
managers=[
("objects", bd_api.apps.account.models.BDGroupManager()),
("objects", backend.apps.account.models.BDGroupManager()),
],
),
migrations.CreateModel(
Expand Down Expand Up @@ -228,7 +228,7 @@ class Migration(migrations.Migration):
"verbose_name_plural": "BD roles",
},
managers=[
("objects", bd_api.apps.account.models.BDRoleManager()),
("objects", backend.apps.account.models.BDRoleManager()),
],
),
migrations.CreateModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
from django.db.models.query import QuerySet
from django.utils import timezone

from bd_api.custom.graphql_jwt import owner_required
from bd_api.custom.model import BaseModel
from bd_api.custom.storage import OverwriteStorage, upload_to, validate_image
from backend.custom.graphql_jwt import owner_required
from backend.custom.model import BaseModel
from backend.custom.storage import OverwriteStorage, upload_to, validate_image


class RegistrationToken(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode

from bd_api.apps.account.models import Account, Subscription
from bd_api.apps.account.token import token_generator
from bd_api.custom.environment import get_frontend_url
from backend.apps.account.models import Account, Subscription
from backend.apps.account.token import token_generator
from backend.custom.environment import get_frontend_url


def send_activation_email(account: Account):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from huey.contrib.djhuey import db_task
from loguru import logger

from bd_api.apps.account.models import Account, Subscription
from backend.apps.account.models import Account, Subscription


@db_task()
Expand Down
12 changes: 6 additions & 6 deletions bd_api/apps/account/tests.py → backend/apps/account/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode

from bd_api.apps.account.models import Account
from backend.apps.account.models import Account


@pytest.mark.django_db
Expand All @@ -20,7 +20,7 @@ def test_account_create():


@pytest.mark.django_db
@patch("bd_api.apps.account.signals.EmailMultiAlternatives")
@patch("backend.apps.account.signals.EmailMultiAlternatives")
def test_activate_account_signal(mock: MagicMock):
Account.objects.create(
username="john.doe",
Expand All @@ -32,7 +32,7 @@ def test_activate_account_signal(mock: MagicMock):


@pytest.mark.django_db
@patch("bd_api.apps.account.signals.render_to_string")
@patch("backend.apps.account.signals.render_to_string")
def test_activate_account_confirmation(mock: MagicMock, client: Client):
account = Account.objects.create(
username="john.doe",
Expand All @@ -51,7 +51,7 @@ def test_activate_account_confirmation(mock: MagicMock, client: Client):


@pytest.mark.django_db
@patch("bd_api.apps.account.views.EmailMultiAlternatives")
@patch("backend.apps.account.views.EmailMultiAlternatives")
def test_password_reset_request(mock: MagicMock, client: Client):
account = Account.objects.create(
username="john.doe",
Expand All @@ -70,8 +70,8 @@ def test_password_reset_request(mock: MagicMock, client: Client):


@pytest.mark.django_db
@patch("bd_api.apps.account.views.render_to_string")
@patch("bd_api.apps.account.signals.render_to_string")
@patch("backend.apps.account.views.render_to_string")
@patch("backend.apps.account.signals.render_to_string")
def test_password_reset_confirmation(mock_signal: MagicMock, mock_view: MagicMock, client: Client):
# Create account
account = Account.objects.create(
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.urls import path

from bd_api.apps.account.views import (
from backend.apps.account.views import (
AccountActivateConfirmView,
AccountActivateView,
PasswordResetConfirmView,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
from django.views.decorators.csrf import csrf_exempt
from loguru import logger

from bd_api.apps.account.signals import send_activation_email
from bd_api.apps.account.token import token_generator
from bd_api.custom.environment import get_frontend_url
from backend.apps.account.signals import send_activation_email
from backend.apps.account.token import token_generator
from backend.custom.environment import get_frontend_url


class AccountActivateView(View):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.contrib import admin

from bd_api.apps.account_auth.models import (
from backend.apps.account_auth.models import (
Access,
Domain,
Token,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@


class AuthConfig(AppConfig):
name = "bd_api.apps.account_auth"
name = "backend.apps.account_auth"
verbose_name = "Autenticação e Autorização Interna"
default_auto_field = "django.db.models.BigAutoField"
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from django.utils import timezone
from requests import post

from bd_api.apps.account.models import Account
from bd_api.apps.account_auth.models import Access, Domain, Token
from backend.apps.account.models import Account
from backend.apps.account_auth.models import Access, Domain, Token

URI = str
Status = bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ class PaymentConfig(DjstripeAppConfig):

def ready(self):
super().ready()
import bd_api.apps.account_payment.signals # noqa
import bd_api.apps.account_payment.webhooks # noqa
import backend.apps.account_payment.signals # noqa
import backend.apps.account_payment.webhooks # noqa
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from loguru import logger
from stripe import Customer as StripeCustomer

from bd_api.apps.account.models import Account, Subscription
from bd_api.apps.account_payment.webhooks import add_user, remove_user
from bd_api.custom.graphql_base import CountableConnection, PlainTextNode
from backend.apps.account.models import Account, Subscription
from backend.apps.account_payment.webhooks import add_user, remove_user
from backend.custom.graphql_base import CountableConnection, PlainTextNode

if settings.STRIPE_LIVE_MODE:
stripe.api_key = settings.STRIPE_LIVE_SECRET_KEY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from djstripe.models import Customer as DJStripeCustomer
from graphene_django.utils.testing import graphql_query

from bd_api.apps.account.models import Account
from backend.apps.account.models import Account

QUERY = (
Path(__file__)
Expand Down Expand Up @@ -75,8 +75,8 @@ def test_all_stripe_price_call(query):


@pytest.mark.django_db
@patch("bd_api.apps.payment.graphql.StripeCustomer")
@patch("bd_api.apps.payment.graphql.DJStripeCustomer")
@patch("backend.apps.payment.graphql.StripeCustomer")
@patch("backend.apps.payment.graphql.DJStripeCustomer")
def test_create_stripe_customer_call(
djst_customer: MagicMock, strp_customer: MagicMock, query, account
):
Expand All @@ -86,7 +86,7 @@ def test_create_stripe_customer_call(


@pytest.mark.django_db
@patch("bd_api.apps.payment.graphql.StripeCustomer")
@patch("backend.apps.payment.graphql.StripeCustomer")
def test_update_stripe_customer_call(strp_customer: MagicMock, query, account, customer):
query("UpdateStripeCustomer")
strp_customer.modify.assert_called_once()
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from googleapiclient.errors import HttpError
from loguru import logger

from bd_api.apps.account.models import Subscription
from bd_api.custom.client import send_discord_message as send
from backend.apps.account.models import Subscription
from backend.custom.client import send_discord_message as send

logger = logger.bind(module="payment")

Expand Down
File renamed without changes.
File renamed without changes.
Loading
Loading