Skip to content

Commit

Permalink
Added the project
Browse files Browse the repository at this point in the history
  • Loading branch information
bdriguesdev committed Jan 17, 2020
0 parents commit 3baac86
Show file tree
Hide file tree
Showing 179 changed files with 27,332 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.DS_Store
node_modules
db.sqlite3
/dist
/venv
__pycache__

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
16 changes: 16 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
django = "*"
whitenoise = "*"
pyjwt = "*"
pillow = "*"
django-cors-headers = "*"

[requires]
python_version = "3.7"
110 changes: 110 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frontend

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Run your tests
```
npm run test
```

### Lints and fixes files
```
npm run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
5 changes: 5 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
Empty file added backend/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions backend/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for backend project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')

application = get_asgi_application()
Empty file added backend/auth_app/__init__.py
Empty file.
6 changes: 6 additions & 0 deletions backend/auth_app/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.contrib import admin

from .models import Client, Business

admin.site.register(Client)
admin.site.register(Business)
5 changes: 5 additions & 0 deletions backend/auth_app/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class AuthAppConfig(AppConfig):
name = 'auth_app'
49 changes: 49 additions & 0 deletions backend/auth_app/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Generated by Django 3.0 on 2019-12-07 02:31

import backend.auth_app.models
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Business',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
('email', models.EmailField(max_length=100, unique=True)),
('password', models.CharField(max_length=100)),
('cnpj', models.CharField(max_length=30)),
('city', models.CharField(max_length=50)),
('state', models.CharField(max_length=30)),
('photo', models.ImageField(upload_to=backend.auth_app.models.business_directory_path)),
('created', models.DateTimeField()),
('updated', models.DateTimeField()),
],
options={
'verbose_name_plural': 'Businesses',
},
),
migrations.CreateModel(
name='Client',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=25)),
('last_name', models.CharField(max_length=50)),
('birthday', models.DateTimeField()),
('email', models.EmailField(max_length=50, unique=True)),
('password', models.CharField(max_length=80)),
('city', models.CharField(max_length=50)),
('state', models.CharField(max_length=35)),
('photo', models.ImageField(upload_to=backend.auth_app.models.client_directory_path)),
('created', models.DateTimeField()),
('updated', models.DateTimeField()),
],
),
]
Empty file.
39 changes: 39 additions & 0 deletions backend/auth_app/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from django.db import models

def client_directory_path(instance, filename):
return 'clients/{0}/{1}'.format(instance, filename)

def business_directory_path(instance, filename):
return 'businesses/{0}/{1}'.format(instance, filename)

class Client(models.Model):
first_name = models.CharField(max_length=25)
last_name = models.CharField(max_length=50)
birthday = models.DateTimeField()
email = models.EmailField(unique=True, max_length=50)
password = models.CharField(max_length=80)
city = models.CharField(max_length=50)
state = models.CharField(max_length=35)
photo = models.ImageField(upload_to=client_directory_path)
created = models.DateTimeField()
updated = models.DateTimeField()

def __str__(self):
return str(self.id)

class Business(models.Model):
name = models.CharField(max_length=50)
email = models.EmailField(unique=True, max_length=100)
password = models.CharField(max_length=100)
cnpj = models.CharField(max_length=30)
city = models.CharField(max_length=50)
state = models.CharField(max_length=30)
photo = models.ImageField(upload_to=business_directory_path)
created = models.DateTimeField()
updated = models.DateTimeField()

class Meta:
verbose_name_plural = "Businesses"

def __str__(self):
return str(self.id)
16 changes: 16 additions & 0 deletions backend/auth_app/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from rest_framework import serializers

from .models import Client, Business

class ClientSerializer(serializers.ModelSerializer):
# first_name = serializers.CharField()

class Meta:
model = Client
fields = ['id', 'photo', 'first_name', 'last_name', 'birthday', 'city', 'state']

class BusinessSerializer(serializers.ModelSerializer):

class Meta:
model = Business
fields = ['id', 'photo', 'name', 'email', 'city', 'state']
3 changes: 3 additions & 0 deletions backend/auth_app/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
11 changes: 11 additions & 0 deletions backend/auth_app/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.urls import path

from . import views

urlpatterns = [
path('test/', views.Test.as_view()),
path('client/create/', views.CreateClient.as_view()),
path('login/', views.Login.as_view()),
path('business/create/', views.CreateBusiness.as_view()),
path('photo_uploader/', views.UserAvatarUploader.as_view())
]
Loading

0 comments on commit 3baac86

Please sign in to comment.