Skip to content

Commit

Permalink
feat(core): fix #79 add formatting for core and correct ui formatting (
Browse files Browse the repository at this point in the history
…#81)

* fix #79 add formating for core and correct ui formating
* reorganize folders
  • Loading branch information
kirubeltadesse authored Sep 4, 2023
1 parent 6170e9c commit 669ab84
Show file tree
Hide file tree
Showing 60 changed files with 458 additions and 16,485 deletions.
71 changes: 36 additions & 35 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
{
"name": "Existing Docker Compose (Extend)",
"name": "Existing Docker Compose (Extend)",

"dockerComposeFile": ["docker-compose.yml"],
"dockerComposeFile": ["docker-compose.yml"],

"service": "svc",
"service": "svc",

"workspaceFolder": "/workspace",
"workspaceFolder": "/workspace",

// Set *default* container specific settings.json values on container create.
"settings": {
"_workbench.uiExtensions": ["peterjausovec.vscode-docker"],
"python.jediEnabled": false,
"python.testing.pytestEnabled": true,
"pythonTestExplorer.testFramework": "pytest",
"python.testing.autoTestDiscoverOnSaveEnabled": true,
"python.pythonPath": "/usr/local/bin/python3",
"python.testing.pytestPath": "/usr/local/bin/pytest",
"editor.formatOnSave": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.fontFamily": "Cascadia Code, Fira Code",
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
// Set *default* container specific settings.json values on container create.
"settings": {
"python.formatting.provider": "black",
"_workbench.uiExtensions": ["peterjausovec.vscode-docker"],
"python.jediEnabled": false,
"python.testing.pytestEnabled": true,
"pythonTestExplorer.testFramework": "pytest",
"python.testing.autoTestDiscoverOnSaveEnabled": true,
"python.pythonPath": "/usr/local/bin/python3",
"python.testing.pytestPath": "/usr/local/bin/pytest",
"editor.formatOnSave": false,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.fontFamily": "Cascadia Code, Fira Code",
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
},
"[python]": {
"editor.defaultFormatter": "ms-python.python"
},
"grammarly.files.include": ["**/*.md", "**/*.txt"]
},
"[python]": {
"editor.defaultFormatter": "ms-python.python"
},
"grammarly.files.include": ["**/*.md", "**/*.txt"]
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"github.copilot",
"eamodio.gitlens",
"shardulm94.trailing-spaces",
"esbenp.prettier-vscode",
"ms-python.python",
"gruntfuggly.todo-tree",
"cweijan.vscode-database-client2",
"littlefoxteam.vscode-python-test-adapter",
"ms-azuretools.vscode-docker"
]
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"github.copilot",
"eamodio.gitlens",
"shardulm94.trailing-spaces",
"esbenp.prettier-vscode",
"ms-python.python",
"gruntfuggly.todo-tree",
"cweijan.vscode-database-client2",
"littlefoxteam.vscode-python-test-adapter",
"ms-azuretools.vscode-docker"
]
}
104 changes: 52 additions & 52 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
repository:
# See https://developer.github.com/v3/repos/#edit for all available settings.
# See https://developer.github.com/v3/repos/#edit for all available settings.

# The name of the repository. Changing this will rename the repository
name: sap-web
# The name of the repository. Changing this will rename the repository
name: sap-core

# A short description of the repository that will show up on GitHub
description: description of repo
# A short description of the repository that will show up on GitHub
description: description of repo

# A URL with more information about the repository
homepage: https://swarmies.github.io/sap-web/
# A URL with more information about the repository
homepage: https://swarmies.github.io/sap-core/

# Either `true` to make the repository private, or `false` to make it public.
private: false
# Either `true` to make the repository private, or `false` to make it public.
private: false

# Either `true` to enable issues for this repository, `false` to disable them.
has_issues: true
# Either `true` to enable issues for this repository, `false` to disable them.
has_issues: true

# Either `true` to enable the wiki for this repository, `false` to disable it.
has_wiki: true
# Either `true` to enable the wiki for this repository, `false` to disable it.
has_wiki: true

# Either `true` to enable downloads for this repository, `false` to disable them.
has_downloads: true
# Either `true` to enable downloads for this repository, `false` to disable them.
has_downloads: true

# Updates the default branch for this repository.
default_branch: develop
# Updates the default branch for this repository.
default_branch: develop

# Either `true` to allow squash-merging pull requests, or `false` to prevent
# squash-merging.
allow_squash_merge: true
# Either `true` to allow squash-merging pull requests, or `false` to prevent
# squash-merging.
allow_squash_merge: true

# Either `true` to allow merging pull requests with a merge commit, or `false`
# to prevent merging pull requests with merge commits.
allow_merge_commit: true
# Either `true` to allow merging pull requests with a merge commit, or `false`
# to prevent merging pull requests with merge commits.
allow_merge_commit: true

# Either `true` to allow rebase-merging pull requests, or `false` to prevent
# rebase-merging.
allow_rebase_merge: true
# Either `true` to allow rebase-merging pull requests, or `false` to prevent
# rebase-merging.
allow_rebase_merge: true

# Labels: define labels for Issues and Pull Requests
labels:
- name: bug
color: CC0000
- name: feature
color: 336699
- name: first-timers-only
# include the old name to rename and existing label
oldname: Help Wanted
- name: bug
color: CC0000
- name: feature
color: 336699
- name: first-timers-only
# include the old name to rename and existing label
oldname: Help Wanted

# Collaborators: give specific users access to this repository.
collaborators:
- username: kirubeltadesse
# Note: Only valid on organization-owned repositories.
# The permission to grant the collaborator. Can be one of:
# * `pull` - can pull, but not push to or administer this repository.
# * `push` - can pull and push, but not administer this repository.
# * `admin` - can pull, push and administer this repository.
permission: push
- username: Roberamelaek
permission: pull

- username: dinaolmelak
permission: pull

- username: Getnet12
permission: pull

- username: BAbate
permission: pull
- username: kirubeltadesse
# Note: Only valid on organization-owned repositories.
# The permission to grant the collaborator. Can be one of:
# * `pull` - can pull, but not push to or administer this repository.
# * `push` - can pull and push, but not administer this repository.
# * `admin` - can pull, push and administer this repository.
permission: push

- username: Roberamelaek
permission: pull

- username: dinaolmelak
permission: pull

- username: Getnet12
permission: pull

- username: BAbate
permission: pull
40 changes: 39 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,47 @@
*.pyc
.DS_Store
__pycache__
.coverage*
*/htmlcov/*

/data
env
env/*

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Sphinx documentation
docs/_build/

### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
7 changes: 0 additions & 7 deletions .prettierignore

This file was deleted.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ To run the test you can just use the `pytest` package
pytest
```

Code formating

```bash
python -m black ...
```

---

<details>
Expand Down
4 changes: 2 additions & 2 deletions api/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


class ApiConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'api'
default_auto_field = "django.db.models.BigAutoField"
name = "api"
24 changes: 19 additions & 5 deletions api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,38 @@
from rest_framework import serializers
from backend.models import Event, Mainuser, Student, Mentor


class EventSerializer(serializers.ModelSerializer):
class Meta:
model = Event
fields = ('id', 'title', 'content', 'student', 'mentor', 'start_date', 'end_date', 'status')
fields = (
"id",
"title",
"content",
"student",
"mentor",
"start_date",
"end_date",
"status",
)


# the student class


class StudentSerializer(serializers.ModelSerializer):
class Meta:
model = Mainuser
fields = ('__all__')
model = Mainuser
fields = "__all__"


class MainSerializer(serializers.ModelSerializer):
class Meta:
model = Student
fields = ('__all__')
fields = "__all__"


class MentorSerializer(serializers.ModelSerializer):
class Meta:
model = Mentor
fields = ('__all__')
fields = "__all__"
44 changes: 21 additions & 23 deletions api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,37 @@
from django.contrib.auth.models import User
from django.utils import timezone

class TestEvent(APITestCase):

class TestEvent(APITestCase):
# test if the url is working
def test_view_events(self):
url = reverse('api:list')
response = self.client.get(url, format='json')
url = reverse("api:list")
response = self.client.get(url, format="json")
self.assertEqual(response.status_code, status.HTTP_200_OK)

# test if the data is correct inserted
# test if the data is correct inserted
def create_event(self):

self.test_category = Category.objects.create(name='django')
self.test_category = Category.objects.create(name="django")

self.studentUser = User.objects.create_user(
username='test_user1', password='123456789')
username="test_user1", password="123456789"
)

self.mentorUser = User.objects.create_user(
username='test_user2', password='123456789')

username="test_user2", password="123456789"
)

data = {
'category_id': 1,
'title': 'Event Title',
'content': 'Event Content',
'slug': 'event-title',
'student': self.studentUser,
'mentor': self.mentorUser,
'start_date': timezone.now(),
'end_date': timezone.now(),
'status': 'published'
"category_id": 1,
"title": "Event Title",
"content": "Event Content",
"slug": "event-title",
"student": self.studentUser,
"mentor": self.mentorUser,
"start_date": timezone.now(),
"end_date": timezone.now(),
"status": "published",
}
url = reverse('api:list')
response = self.client.post(url, data, format='json')
url = reverse("api:list")
response = self.client.post(url, data, format="json")
self.assertEqual(response.status_code, status.HTTP_201_CREATED)



Loading

0 comments on commit 669ab84

Please sign in to comment.