first commit

This commit is contained in:
mrtoine 2025-09-20 14:16:14 +02:00
parent b216a187bd
commit f73c77f548
119 changed files with 4504 additions and 4829 deletions

View file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,8 @@
import json
import os
DATA_DIR = os.path.join(os.path.dirname(__file__), '../data')
def load_data(filename):
with open(os.path.join(DATA_DIR, filename), 'r') as f:
return json.load(f)

21
backend/utils/enums.py Normal file
View file

@ -0,0 +1,21 @@
enumerates = {
"status": [
"En cours",
"Terminé",
"Futur projet"
],
"technologies": [
"HTML & CSS",
"Python",
"Django",
"React",
"NodeJS",
"Angular",
"C#",
"PHP",
"Javascript",
"TypeScript",
"Unity",
"Godot"
],
}

View file

@ -0,0 +1,33 @@
import json
import os
def load_json(filename):
if not os.path.exists(filename):
return []
with open(filename, 'r', encoding='utf-8') as f:
return json.load(f)
def save_json(filename, data):
with open(filename, 'w', encoding='utf-8') as f:
json.dump(data, f, indent=4, ensure_ascii=False)
def add_entry(filename, entry):
data = load_json(filename)
data.append(entry)
save_json(filename, data)
return entry
def update_entry(filename, entry_id, new_entry):
data = load_json(filename)
for i, item in enumerate(data):
if item.get('id') == entry_id:
data[i] = new_entry
save_json(filename, data)
return new_entry
return None
def delete_entry(filename, entry_id):
data = load_json(filename)
new_data = [item for item in data if item.get('id') != entry_id]
save_json(filename, new_data)
return len(data) != len(new_data)