Skip to content

Commit

Permalink
Merge pull request #16 from HE-Arc/dev
Browse files Browse the repository at this point in the history
Rendu intermédiaire
  • Loading branch information
AlexandreMaquet-HeArc authored Mar 22, 2024
2 parents 86b181f + ef01b30 commit eec4040
Show file tree
Hide file tree
Showing 52 changed files with 2,014 additions and 11,560 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ source 'https://rubygems.org'

gem 'capistrano'
gem 'ed25519'
gem 'bcrypt_pbkdf'
gem 'bcrypt_pbkdf'

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# ARConnect-Manager


ARConnect-Manager is a webapp created to manage tournaments in a LAN-like event.

[Access the demo here](https://arconnect.k8s.ing.he-arc.ch/)

30 changes: 24 additions & 6 deletions api/arconnectmanager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@


from pathlib import Path
import environ
import os

env = environ.Env(
# set casting, default value
DEBUG=(bool, False)
)

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand All @@ -27,6 +34,7 @@




# Take environment variables from .env file
environ.Env.read_env(os.path.join(BASE_DIR, '.env'))

Expand All @@ -39,18 +47,28 @@

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS')


# Application definition

CORS_ALLOWED_ORIGINS = [
"http://localhost:5173",
"http://127.0.0.1:5173",
]

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

MIDDLEWARE = [
"corsheaders.middleware.CorsMiddleware",
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
Expand Down
3 changes: 2 additions & 1 deletion api/arconnectmanager/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include

urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('arconnectmanagerapp.urls')),
]
3 changes: 2 additions & 1 deletion api/arconnectmanagerapp/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.contrib import admin
from arconnectmanagerapp.models import TournamentItem

# Register your models here.
admin.site.register(TournamentItem)
32 changes: 32 additions & 0 deletions api/arconnectmanagerapp/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 5.0.1 on 2024-03-15 10:30

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = []

operations = [
migrations.CreateModel(
name="TournamentItem",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=100)),
("description", models.TextField()),
("state", models.IntegerField()),
("created", models.DateTimeField(auto_now_add=True)),
("updated", models.DateTimeField(auto_now=True)),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 5.0.1 on 2024-03-21 20:46

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("arconnectmanagerapp", "0001_initial"),
]

operations = [
migrations.AlterField(
model_name="tournamentitem",
name="state",
field=models.IntegerField(
default=0,
validators=[
django.core.validators.MinValueValidator(0),
django.core.validators.MaxValueValidator(3),
],
),
),
]
13 changes: 12 additions & 1 deletion api/arconnectmanagerapp/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
from django.db import models
from django.contrib.auth.models import User
from django.core.validators import MinValueValidator, MaxValueValidator

# Create your models here.
#Tournament model
class TournamentItem(models.Model):
name = models.CharField(max_length=100) #Name of the tournament
description = models.TextField() #Description of the tournament
state = models.IntegerField( #State of the tournament : 0=closed, 1=open, 2=started 3=finished
default=0,
validators=[MinValueValidator(0), MaxValueValidator(3)]
)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
16 changes: 16 additions & 0 deletions api/arconnectmanagerapp/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from rest_framework import serializers
from django.contrib.auth.models import User
from .models import TournamentItem

class TournamentItemSerializer(serializers.HyperlinkedModelSerializer):
''' Serializer for the TournamentItem model '''
class Meta:
model = TournamentItem
fields = [
'url',
'id',
'name',
'description',
'state'
]

10 changes: 10 additions & 0 deletions api/arconnectmanagerapp/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.urls import path, include
from . import views
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register(r'tournaments', views.TournamentItemViewSet, basename='tournamentitem')

urlpatterns = [
path("", include(router.urls))
]
10 changes: 10 additions & 0 deletions api/arconnectmanagerapp/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
from django.shortcuts import render
from rest_framework import viewsets
from .models import TournamentItem
from .serializers import TournamentItemSerializer

# Create your views here.

class TournamentItemViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows tournament items to be viewed or edited.
"""
queryset = TournamentItem.objects.all()
serializer_class = TournamentItemSerializer
8 changes: 6 additions & 2 deletions api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
asgiref==3.7.2
Django==5.0.3

django-cors-headers==4.3.1
django-environ==0.11.2
django-rest-framework==0.1.0
djangorestframework==3.15.0
sqlparse==0.4.4
tzdata==2024.1
django-environ==0.11.2
tzdata==2024.1
9 changes: 8 additions & 1 deletion config/deploy.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# config valid for current version and patch releases of Capistrano
lock "~> 3.18.1"


set :application, "ARConnect-Manager"
set :repo_url, "https://github.com/HE-Arc/ARConnect-Manager.git"

Expand All @@ -21,6 +22,9 @@
# set :pty, true

# Default value for :linked_files is []

# TODO : append :linked_files, '.env'

# append :linked_files, "config/database.yml", 'config/master.key'

# Default value for linked_dirs is []
Expand Down Expand Up @@ -56,10 +60,13 @@
task :install do
on roles([:app, :web]) do |h|
execute "pip install -r #{release_path}/api/requirements.txt"

end
end
end



# Construire et déployer l'application Vue.js
after 'deploy:updated', 'vue:deploy'
namespace :vue do
Expand All @@ -83,4 +90,4 @@
execute :sudo, 'systemctl restart gunicorn'
end
end
end
end
3 changes: 2 additions & 1 deletion config/deploy/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
# server "db.example.com", user: "deploy", roles: %w{db}
server "157.26.64.211", user: "django", roles: %w{app db web}, port: 31121


set :deploy_to, "/home/django/project/"
set :branch, "main"




# role-based syntax
# ==================

Expand Down Expand Up @@ -64,3 +64,4 @@
# auth_methods: %w(publickey password)
# # password: "please use keys"
# }

23 changes: 12 additions & 11 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
.DS_Store
node_modules
/dist


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

# Log files
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.vscode
.DS_Store
*.suo
*.ntvs*
*.njsproj
Expand Down
25 changes: 4 additions & 21 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
# frontend
# Vue 3 + Vite

## Project setup
```
npm install
```
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

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

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

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

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
5 changes: 0 additions & 5 deletions frontend/babel.config.js

This file was deleted.

22 changes: 22 additions & 0 deletions frontend/humans.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* TEAM */
Name: Jonas Flückiger.
Role: Developper, designer.

Name: Alexandre Maquet.
Role: Developper.

Name: Daniel Moreira Dos Santos.
Role: Developper.



/* THANKS */
Name: HE-Arc
Site: https://he-arc.ch


/* SITE */
Last update: 2024/03/08
Standards: HTML5, CSS3.
Components: VueJS, ViteJS, SASS, Django.
Software: VSCode, NodeJS, Docker.
Loading

0 comments on commit eec4040

Please sign in to comment.