Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdullahBakir97 committed May 27, 2024
1 parent 9b7b3da commit bddc468
Show file tree
Hide file tree
Showing 25 changed files with 436 additions and 289 deletions.
Binary file modified backend/db.sqlite3
Binary file not shown.
Binary file modified backend/project/__pycache__/settings.cpython-312.pyc
Binary file not shown.
Binary file modified backend/project/__pycache__/urls.cpython-312.pyc
Binary file not shown.
32 changes: 17 additions & 15 deletions backend/project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

from pathlib import Path
from celery.schedules import crontab
from datetime import timedelta

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


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

Expand All @@ -28,7 +28,6 @@

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
Expand All @@ -39,18 +38,18 @@
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",


'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'rest_framework',
'djoser',
'rest_framework.authtoken',
'dj_rest_auth',
'django.contrib.sites',
'corsheaders',
'channels',
'django_celery_beat',
'tasks',

]

MIDDLEWARE = [
Expand All @@ -62,6 +61,7 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
'allauth.account.middleware.AccountMiddleware',
]

CELERY_BROKER_URL = 'redis://localhost:6379/0'
Expand Down Expand Up @@ -93,12 +93,20 @@

AUTH_USER_MODEL = 'accounts.CustomUser'

from datetime import timedelta
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
)

ACCOUNT_EMAIL_VERIFICATION = 'none'
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_EMAIL_REQUIRED = False

SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60),
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
}

CORS_ALLOWED_ORIGINS = [
'http://localhost:8080',
'http://127.0.0.1:8080',
Expand All @@ -125,7 +133,6 @@
]

WSGI_APPLICATION = "project.wsgi.application"

ASGI_APPLICATION = 'project.asgi.application'

CHANNEL_LAYERS = {
Expand All @@ -136,6 +143,7 @@
},
},
}

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

Expand All @@ -146,7 +154,6 @@
}
}


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

Expand All @@ -165,19 +172,14 @@
},
]


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

LANGUAGE_CODE = "en-us"

TIME_ZONE = "UTC"

USE_I18N = True

USE_TZ = True


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

Expand All @@ -186,4 +188,4 @@
# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
2 changes: 2 additions & 0 deletions backend/project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
path('admin/', admin.site.urls),
path('api/', include('tasks.urls')),
path('api/auth/', include('dj_rest_auth.urls')),
path('api/auth/registration/', include('dj_rest_auth.registration.urls')),
path('auth/', include('djoser.urls')),
path('auth/', include('djoser.urls.authtoken')),
]
Binary file modified backend/tasks/__pycache__/urls.cpython-312.pyc
Binary file not shown.
Binary file modified backend/tasks/__pycache__/views.cpython-312.pyc
Binary file not shown.
9 changes: 7 additions & 2 deletions backend/tasks/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import TaskViewSet, TimeEntryViewSet, CommentViewSet, ProjectViewSet, FileViewSet, EventViewSet
from .views import TaskViewSet, TimeEntryViewSet, CommentViewSet, ProjectViewSet, FileViewSet, EventViewSet, register, task_status_report, project_time_report

router = DefaultRouter()
router.register(r'projects', ProjectViewSet)
Expand All @@ -10,10 +10,15 @@
router.register(r'comments', CommentViewSet)
router.register(r'events', EventViewSet)

urlpatterns = router.urls




urlpatterns = [
path('', include(router.urls)),

path('register/', register, name='register'),
path('task-status-report/', task_status_report, name='task_status_report'),
path('project-time-report/<int:project_id>/', project_time_report, name='project_time_report'),

]
2 changes: 1 addition & 1 deletion backend/tasks/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def task_status_report(request):

@api_view(['GET'])
def project_time_report(request, project_id):
data = Task.objects.filter(project_id=project_id).aggregate(total_time=Sum('time_spent'))
data = Task.objects.filter(project_id=project_id).aggregate(total_time=Sum('duration'))
return JsonResponse(data)


Expand Down
13 changes: 7 additions & 6 deletions project-frontend/package-lock.json

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

5 changes: 3 additions & 2 deletions project-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"vue-chartjs": "^5.3.1",
"vue-router": "^4.3.2",
"vuedraggable": "^2.24.3",
"vuex": "^4.1.0"
"vuex": "^4.0.2"
},
"devDependencies": {
"@babel/core": "^7.12.16",
Expand All @@ -25,7 +25,8 @@
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3"
"eslint-plugin-vue": "^8.0.3",
"launch-editor-middleware": "^2.6.1"
},
"eslintConfig": {
"root": true,
Expand Down
54 changes: 0 additions & 54 deletions project-frontend/src/components/Comments.vue

This file was deleted.

58 changes: 58 additions & 0 deletions project-frontend/src/components/CommentsSection.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<template>
<div class="comments">
<h2>Comments</h2>
<div v-if="task">
<textarea v-model="newComment.content" placeholder="Add a comment..."></textarea>
<button @click="addComment">Post Comment</button>
<ul>
<li v-for="comment in comments" :key="comment.id">
{{ comment.content }} - {{ comment.user.username }}
</li>
</ul>
</div>
</div>
</template>

<script>
export default {
props: ['taskId'],
data() {
return {
newComment: {
content: '',
task: this.taskId,
user: 1, // Replace with the logged-in user ID
},
};
},
computed: {
task() {
return this.$store.state.tasks.find(task => task.id === this.taskId);
},
comments() {
return this.$store.getters.commentsByTask(this.taskId);
},
},
methods: {
async addComment() {
try {
await this.$store.dispatch('createComment', this.newComment);
this.newComment.content = '';
} catch (error) {
console.error('Error creating comment:', error);
}
},
},
async created() {
await this.$store.dispatch('fetchComments');
},
};
</script>

<style scoped>
.comments {
border: 1px solid #ccc;
padding: 10px;
margin-top: 20px;
}
</style>
41 changes: 0 additions & 41 deletions project-frontend/src/components/File.vue

This file was deleted.

Loading

0 comments on commit bddc468

Please sign in to comment.