Skip to content

Commit

Permalink
API changed
Browse files Browse the repository at this point in the history
  • Loading branch information
ArqumShaikh committed Oct 22, 2019
1 parent d9d6cce commit 918c8ec
Show file tree
Hide file tree
Showing 18 changed files with 449 additions and 0 deletions.
Binary file added backend/db.sqlite3
Binary file not shown.
Empty file added backend/laundryAPP/__init__.py
Empty file.
122 changes: 122 additions & 0 deletions backend/laundryAPP/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
"""
Django settings for laundryAPP project.
Generated by 'django-admin startproject' using Django 2.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '65v3dy#90p5#^jucu*un7v)%5x18&mkj9^o=tb%ra@d%gzlmx9'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'laundryApi',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'laundryAPP.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'laundryAPP.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/

STATIC_URL = '/static/'
38 changes: 38 additions & 0 deletions backend/laundryAPP/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""laundryAPP URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
"""laundaryApp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.conf.urls import include

urlpatterns = [
path('admin/', admin.site.urls),
path('api/',include('laundryApi.urls')),
]
16 changes: 16 additions & 0 deletions backend/laundryAPP/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for laundryAPP project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

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

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

# Register your models here.
from .models import ItemDetails,CustomerDetails,CustomerLaundryDetails,TrackingProgress,PaymentDetails

admin.site.register(ItemDetails)
admin.site.register(CustomerDetails)
admin.site.register(CustomerLaundryDetails)
admin.site.register(TrackingProgress)
admin.site.register(PaymentDetails)
5 changes: 5 additions & 0 deletions backend/laundryApi/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class LaundryapiConfig(AppConfig):
name = 'laundryApi'
65 changes: 65 additions & 0 deletions backend/laundryApi/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Generated by Django 2.2.6 on 2019-10-20 10:48

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='CustomerDetails',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('rollNo', models.CharField(max_length=20)),
('roomNo', models.CharField(max_length=10)),
('blockNo', models.IntegerField()),
('name', models.CharField(max_length=20)),
('email', models.CharField(max_length=25)),
('phoneNo', models.CharField(max_length=15)),
('profilePic', models.ImageField(blank=True, upload_to='')),
],
),
migrations.CreateModel(
name='ItemDetails',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('item', models.CharField(max_length=100)),
('amount', models.IntegerField()),
],
),
migrations.CreateModel(
name='TrackingProgress',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('dateGiven', models.DateTimeField(auto_now_add=True)),
('readyToPick', models.BooleanField(default=False)),
('customer', models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='laundryApi.CustomerDetails')),
],
),
migrations.CreateModel(
name='PaymentDetails',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('dateGiven', models.DateTimeField(auto_now_add=True)),
('amount', models.IntegerField()),
('customer', models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='laundryApi.CustomerDetails')),
],
),
migrations.CreateModel(
name='CustomerLaundryDetails',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('dateGiven', models.DateTimeField(auto_now_add=True)),
('datePickup', models.DateTimeField()),
('quantity', models.IntegerField()),
('customer', models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='laundryApi.CustomerDetails')),
('item', models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='laundryApi.ItemDetails')),
],
),
]
23 changes: 23 additions & 0 deletions backend/laundryApi/migrations/0002_auto_20191022_0908.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.2.6 on 2019-10-22 09:08

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('laundryApi', '0001_initial'),
]

operations = [
migrations.RenameField(
model_name='customerdetails',
old_name='rollNo',
new_name='key',
),
migrations.AlterField(
model_name='customerdetails',
name='profilePic',
field=models.CharField(max_length=25),
),
]
18 changes: 18 additions & 0 deletions backend/laundryApi/migrations/0003_auto_20191022_0923.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.6 on 2019-10-22 09:23

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('laundryApi', '0002_auto_20191022_0908'),
]

operations = [
migrations.AlterField(
model_name='customerdetails',
name='blockNo',
field=models.CharField(max_length=10),
),
]
Empty file.
32 changes: 32 additions & 0 deletions backend/laundryApi/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from django.db import models

# Create your models here.
class ItemDetails(models.Model):
item = models.CharField(max_length=100)
amount = models.IntegerField()

class CustomerDetails(models.Model):
key = models.CharField(max_length = 20)
roomNo = models.CharField(max_length = 10)
blockNo = models.CharField(max_length = 10)
name = models.CharField(max_length = 20)
email = models.CharField(max_length = 25)
phoneNo = models.CharField(max_length = 15)
profilePic = models.CharField(max_length = 25)

class CustomerLaundryDetails(models.Model):
customer = models.ForeignKey(CustomerDetails,on_delete=models.CASCADE,default=None)
dateGiven = models.DateTimeField(auto_now_add=True)
item = models.ForeignKey(ItemDetails,on_delete=models.CASCADE,default=None)
datePickup = models.DateTimeField(default=None)
quantity = models.IntegerField()

class TrackingProgress(models.Model):
customer = models.ForeignKey(CustomerDetails,on_delete=models.CASCADE,default=None)
dateGiven = models.DateTimeField(auto_now_add=True)
readyToPick = models.BooleanField(default=False)

class PaymentDetails(models.Model):
customer = models.ForeignKey(CustomerDetails,on_delete=models.CASCADE,default=None)
dateGiven = models.DateTimeField(auto_now_add=True)
amount = models.IntegerField()
28 changes: 28 additions & 0 deletions backend/laundryApi/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from rest_framework import serializers
from laundryApi.models import ItemDetails,CustomerDetails,CustomerLaundryDetails,TrackingProgress,PaymentDetails


class ItemDetailsSerializer(serializers.ModelSerializer):
class Meta:
model = ItemDetails
fields = ['item','amount']

class CustomerDetailsSerializer(serializers.ModelSerializer):
class Meta:
model = CustomerDetails
fields = ['key','roomNo','blockNo','name','email','phoneNo','profilePic']

class CustomerLaundryDetailsSerializer(serializers.ModelSerializer):
class Meta:
model = CustomerLaundryDetails
fields = ['custmer','dateGiven','item','datePickup','quantity']

class TrackingProgressSerializer(serializers.ModelSerializer):
class Meta:
model = TrackingProgress
fields = ['customer','dateGiven','readyToPick']

class PaymentDetailsSerializer(serializers.ModelSerializer):
class Meta:
model = PaymentDetails
fields = ['customer','dateGiven','amount']
3 changes: 3 additions & 0 deletions backend/laundryApi/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.
10 changes: 10 additions & 0 deletions backend/laundryApi/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.contrib import admin
from django.urls import path
from django.conf.urls import include
from . import views

urlpatterns = [
path('customerDetails/',views.customerDetails.as_view()),
path('retreiveCustomerLaundry/',views.retreiveCustomerLaundry.as_view()),
path('enterCustomerLaundry/',views.enterCustomerLaundry.as_view())
]
Loading

0 comments on commit 918c8ec

Please sign in to comment.