-
Notifications
You must be signed in to change notification settings - Fork 0
[WIP] Backend rewrite #12
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
Open
macro1
wants to merge
6
commits into
master
Choose a base branch
from
sked
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
36257bb
Add editorconfig
macro1 1607a8e
Initial sked models and API scafolding
macro1 9f449d2
Set html indent to 2 spaces
macro1 1479bad
Add migrations
macro1 3398b98
Add basic org permissioning
macro1 52a69fb
Test organization serializer
macro1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # EditorConfig is awesome: http://EditorConfig.org | ||
|
|
||
| root = true | ||
|
|
||
| [*] | ||
| end_of_line = lf | ||
| insert_final_newline = true | ||
| charset = utf-8 | ||
| indent_style = space | ||
| indent_size = 4 | ||
|
|
||
| [*.{js,s{a,c}ss}] | ||
| indent_size = 2 | ||
This file contains hidden or 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
Empty file.
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| from django.contrib import admin | ||
|
|
||
| from . import models | ||
|
|
||
| admin.site.register(models.Organization) |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from __future__ import unicode_literals | ||
|
|
||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class SkedConfig(AppConfig): | ||
| name = 'sked' |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,203 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # Generated by Django 1.9.4 on 2016-10-27 03:52 | ||
| from __future__ import unicode_literals | ||
|
|
||
| from django.conf import settings | ||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
| import uuid | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| initial = True | ||
|
|
||
| dependencies = [ | ||
| migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name='Date', | ||
| fields=[ | ||
| ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)), | ||
| ('description', models.CharField(max_length=100)), | ||
| ('deleted', models.DateTimeField(null=True)), | ||
| ('date', models.DateField(db_index=True)), | ||
| ], | ||
| options={ | ||
| 'abstract': False, | ||
| }, | ||
| ), | ||
| migrations.CreateModel( | ||
| name='Expertise', | ||
| fields=[ | ||
| ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)), | ||
| ('description', models.CharField(max_length=100)), | ||
| ('deleted', models.DateTimeField(null=True)), | ||
| ], | ||
| options={ | ||
| 'abstract': False, | ||
| }, | ||
| ), | ||
| migrations.CreateModel( | ||
| name='Job', | ||
| fields=[ | ||
| ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)), | ||
| ('description', models.CharField(max_length=100)), | ||
| ('deleted', models.DateTimeField(null=True)), | ||
| ], | ||
| options={ | ||
| 'abstract': False, | ||
| }, | ||
| ), | ||
| migrations.CreateModel( | ||
| name='JobTaskFact', | ||
| fields=[ | ||
| ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('backlog_minutes', models.IntegerField(default=0)), | ||
| ('complete_minutes', models.IntegerField(default=0)), | ||
| ('job_complete', models.BooleanField(default=False)), | ||
| ('date', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Date')), | ||
| ('expertise', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Expertise')), | ||
| ('job', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Job')), | ||
| ], | ||
| ), | ||
| migrations.CreateModel( | ||
| name='JobTasks', | ||
| fields=[ | ||
| ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('job', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Job')), | ||
| ], | ||
| ), | ||
| migrations.CreateModel( | ||
| name='JobType', | ||
| fields=[ | ||
| ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)), | ||
| ('description', models.CharField(max_length=100)), | ||
| ('deleted', models.DateTimeField(null=True)), | ||
| ], | ||
| options={ | ||
| 'abstract': False, | ||
| }, | ||
| ), | ||
| migrations.CreateModel( | ||
| name='Organization', | ||
| fields=[ | ||
| ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)), | ||
| ('description', models.CharField(max_length=100)), | ||
| ], | ||
| ), | ||
| migrations.CreateModel( | ||
| name='Product', | ||
| fields=[ | ||
| ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)), | ||
| ('description', models.CharField(max_length=100)), | ||
| ('deleted', models.DateTimeField(null=True)), | ||
| ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Organization')), | ||
| ], | ||
| options={ | ||
| 'abstract': False, | ||
| }, | ||
| ), | ||
| migrations.CreateModel( | ||
| name='ProductTasks', | ||
| fields=[ | ||
| ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
| ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Product')), | ||
| ], | ||
| ), | ||
| migrations.CreateModel( | ||
| name='Task', | ||
| fields=[ | ||
| ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)), | ||
| ('description', models.CharField(max_length=100)), | ||
| ('deleted', models.DateTimeField(null=True)), | ||
| ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Organization')), | ||
| ], | ||
| options={ | ||
| 'abstract': False, | ||
| }, | ||
| ), | ||
| migrations.CreateModel( | ||
| name='Technician', | ||
| fields=[ | ||
| ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)), | ||
| ('description', models.CharField(max_length=100)), | ||
| ('deleted', models.DateTimeField(null=True)), | ||
| ('organization', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Organization')), | ||
| ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
| ], | ||
| options={ | ||
| 'abstract': False, | ||
| }, | ||
| ), | ||
| migrations.AddField( | ||
| model_name='producttasks', | ||
| name='task', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Task'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='jobtype', | ||
| name='organization', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Organization'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='jobtasks', | ||
| name='task', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Task'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='jobtaskfact', | ||
| name='organization', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Organization'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='jobtaskfact', | ||
| name='product', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Product'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='jobtaskfact', | ||
| name='task', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Task'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='jobtaskfact', | ||
| name='technician', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Technician'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='job', | ||
| name='organization', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Organization'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='job', | ||
| name='product', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Product'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='job', | ||
| name='type', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.JobType'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='expertise', | ||
| name='organization', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Organization'), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='date', | ||
| name='organization', | ||
| field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sked.Organization'), | ||
| ), | ||
| migrations.AlterUniqueTogether( | ||
| name='producttasks', | ||
| unique_together=set([('product', 'task')]), | ||
| ), | ||
| migrations.AlterUniqueTogether( | ||
| name='jobtasks', | ||
| unique_together=set([('job', 'task')]), | ||
| ), | ||
| ] |
Empty file.
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| from __future__ import unicode_literals | ||
| import uuid | ||
|
|
||
| from django.db import models | ||
|
|
||
|
|
||
| class Organization(models.Model): | ||
| id = models.UUIDField(editable=False, default=uuid.uuid4, primary_key=True) | ||
| description = models.CharField(max_length=100) | ||
|
|
||
| def __unicode__(self): | ||
| return self.description | ||
|
|
||
|
|
||
| class Dimension(models.Model): | ||
| id = models.UUIDField(editable=False, default=uuid.uuid4, primary_key=True) | ||
| description = models.CharField(max_length=100) | ||
| organization = models.ForeignKey(Organization) | ||
| deleted = models.DateTimeField(null=True) | ||
|
|
||
| def __unicode__(self): | ||
| return self.description | ||
|
|
||
| class Meta: | ||
| abstract = True | ||
|
|
||
|
|
||
| class Technician(Dimension): | ||
| user = models.OneToOneField('auth.User') | ||
|
|
||
|
|
||
| class Expertise(Dimension): | ||
| pass | ||
|
|
||
|
|
||
| class Product(Dimension): | ||
| pass | ||
|
|
||
|
|
||
| class Task(Dimension): | ||
| pass | ||
|
|
||
|
|
||
| class ProductTasks(models.Model): | ||
| product = models.ForeignKey(Product) | ||
| task = models.ForeignKey(Task) | ||
|
|
||
| class Meta: | ||
| unique_together = [ | ||
| ('product', 'task'), | ||
| ] | ||
|
|
||
|
|
||
| class JobType(Dimension): | ||
| pass | ||
|
|
||
|
|
||
| class Job(Dimension): | ||
| product = models.ForeignKey(Product) | ||
| type = models.ForeignKey(JobType) | ||
|
|
||
|
|
||
| class JobTasks(models.Model): | ||
| job = models.ForeignKey(Job) | ||
| task = models.ForeignKey(Task) | ||
|
|
||
| class Meta: | ||
| unique_together = [ | ||
| ('job', 'task'), | ||
| ] | ||
|
|
||
|
|
||
| class Date(Dimension): | ||
| date = models.DateField(db_index=True) | ||
|
|
||
|
|
||
| class JobTaskFact(models.Model): | ||
| organization = models.ForeignKey(Organization) | ||
|
|
||
| # dimensions | ||
| technician = models.ForeignKey(Technician) | ||
| expertise = models.ForeignKey(Expertise) | ||
| job = models.ForeignKey(Job) | ||
| job_type = models.ForeignKey(JobType) | ||
| product = models.ForeignKey(Product) | ||
| task = models.ForeignKey(Task) | ||
| date = models.ForeignKey(Date) | ||
|
|
||
| # metrics | ||
| backlog_minutes = models.IntegerField(default=0) | ||
| complete_minutes = models.IntegerField(default=0) | ||
| job_complete = models.BooleanField(default=False) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we do html here too?