commit 0d1cc70f92511ed517c925f1698a25a3458c60b5 Author: CataX Date: Tue Aug 18 13:49:51 2026 +0300 conf_initial diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c5dd6ce --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.venv +.git +.gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5772af0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.venv +__pycache__/ +db.sqlite3 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2f5073a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.13-slim + +# Prevent Python from writing pyc files and buffering stdout/stderr +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 + +WORKDIR /app + +# Install dependencies +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy project files +COPY . . diff --git a/Z_comenzi.txt b/Z_comenzi.txt new file mode 100644 index 0000000..650b6c6 --- /dev/null +++ b/Z_comenzi.txt @@ -0,0 +1,24 @@ +### verificare versiune python, trebuie să fie cel puțin versiunea 3.12.2 +$ python3 --version + +### se instalează mediul virtual, dacă e nevoie +$ sudo apt install python3-venv + +### se activează mediul virtual și se ințializează proiectul +$ python3 -m venv .venv +$ source .venv/bin/activate +(.venv) $ python3 -m pip install django~=6.1 psycopg2-binary==2.9.12 +(.venv) $ django-admin startproject eumi__v4_project . +(.venv) $ python3 manage.py runserver +(.venv) $ pip freeze > requirements.txt +$ deactivate + +$ git config --global user.name "CataX" +$ git config --global user.email "catalin@x3c.ro" +$ git config --global init.defaultBranch main + +$ git init +$ git status + +$ git add . +$ git commit -m "conf_initial" diff --git a/app_eumi.md b/app_eumi.md new file mode 100644 index 0000000..da95994 --- /dev/null +++ b/app_eumi.md @@ -0,0 +1,42 @@ +# Project Specification: IT Asset & Service Management System + +## 1. Project Overview +* The application is an IT asset management and helpdesk system designed to manage users, equipment, technical interventions, and annual maintenance. +* It will be utilized primarily by the 4 employees of the IT Department responsible for equipment administration and user support. +* The project will follow a modular architecture, featuring distinct applications for each major function: "Users", "Equipment", and "Interventions". + +## 2. Technology Stack & Environment +* **Development & Deployment:** Built using Visual Studio Code, Git, and Docker. It will be deployed exclusively on the internal organizational network. +* **Backend:** Django web framework with a PostgreSQL database. +* **Frontend:** Bootstrap and HTMX. + +## 3. Module Details + +### 3.1. Users Module +* **Organizational Hierarchy:** The organizational structure is according to the attached "organigrama.pdf" document. Employees are in management or executive positions. The organization is composed as follows: the largest structure is called a „Direcție”, headed by an executive director, possibly also by a deputy executive director, they are directly assigned to the „Direcție”. The next structure is called a „Serviciu”, headed by a head of service. The smallest structure is called a „Compartiment”, which includes the executive staff. A „Compartiment” can be part of a „Serviciu”, or directly included in a „Direcție”. +* **Data Fields:** Name, User name, Function/role, Office number, Email address, and Observations. +* **Inventory Sheet:** The system must generate a user sheet detailing everything in their custody, which includes hardware as well as digital assets like qualified digital certificates (token/cloud) and print cards. + +### 3.2. Equipment Module +This module manages three main categories: Computers/Laptops, Monitors, and Peripherals. + +* **Unique Identification:** Every piece of equipment receives a permanent, unique code generated upon entry. + * The format is: `[Category Digit] + [YYMMDD] + [Daily Sequence Number]`. + * Category digits: `9` for Computers/Laptops, `8` for Monitors, `7` for Peripherals. + * Example: The first three computers registered on February 1, 2026, would be `92602011`, `92602012`, and `92602013`. +* **Computers / Laptops Data:** Equipment code, entry date, OEM name, motherboard, CPU, RAM, HDD/SSD, optical drive, GPU, network card MAC address, OS license, additional licenses, and observations. +* **Monitors Data:** Equipment code, entry date, name, serial number, screen diagonal, and observations. +* **Peripherals Data:** Equipment code, entry date, peripheral type (e.g., printer, UPS, scanner, copier, ethernet adapter, audio speakers, external HDD, webcam), name, and serial number. +* **Digital certificate:** each user has a qualified digital certificate. The following information is of interest: certificate type (cloud or usb token), issue date, expiration date, canceled (yes or no). +* **Lifecycle & Maintenance:** + * Equipment requires annual (or more frequent) maintenance, including cleaning, component checks, and upgrades. + * A dedicated maintenance sheet is required for each item, logging all maintenance operations and historical user assignments. + * At the end of its lifecycle (irreparable or obsolete), equipment is removed from inventory via a decommissioning (casare) operation. + +## 4. Core Transactions & System Workflows + +* **CRUD Operations:** All data categories must support Create, Read, Update, and Delete operations. +* **Audit Logging (Crucial):** Every action must be recorded in an audit log detailing who performed the action, the date, the operation type, and the state change (old value vs. new value for updates, or the deleted value). +* **User Relocation Workflow:** * Users can be transferred between Services or offices. + * During a move, they can either retain their current equipment or hand it over and receive new equipment at the new location. +* **Handover Protocol:** Equipment transfers must generate a formal handover-takeover document (proces verbal) that explicitly records the details of the person handing over the equipment, the person receiving it, and the IT staff member validating the transfer. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d65066b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,39 @@ +services: + db: + image: postgres:16 + volumes: + - postgres_data:/var/lib/postgresql/data + environment: + - POSTGRES_DB=djangodb + - POSTGRES_USER=djangouser + - POSTGRES_PASSWORD=djangopass + + pgadmin: + image: dpage/pgadmin4 + environment: + - PGADMIN_DEFAULT_EMAIL=catalin@x3c.ro + - PGADMIN_DEFAULT_PASSWORD=Parola123 + ports: + - "5050:80" + depends_on: + - db + + web: + build: . + command: python manage.py runserver 0.0.0.0:8000 + volumes: + - .:/app + ports: + - "8000:8000" + environment: + - DB_NAME=djangodb + - DB_USER=djangouser + - DB_PASSWORD=djangopass + - DB_HOST=db + - DB_PORT=5432 + depends_on: + - db + +volumes: + postgres_data: + \ No newline at end of file diff --git a/eumi__v4_project/__init__.py b/eumi__v4_project/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/eumi__v4_project/asgi.py b/eumi__v4_project/asgi.py new file mode 100644 index 0000000..58b85c4 --- /dev/null +++ b/eumi__v4_project/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for eumi__v4_project project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/6.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'eumi__v4_project.settings') + +application = get_asgi_application() diff --git a/eumi__v4_project/settings.py b/eumi__v4_project/settings.py new file mode 100644 index 0000000..5c8dc38 --- /dev/null +++ b/eumi__v4_project/settings.py @@ -0,0 +1,127 @@ +""" +Django settings for eumi__v4_project project. + +Generated by 'django-admin startproject' using Django 6.1. + +For more information on this file, see +https://docs.djangoproject.com/en/6.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/6.1/ref/settings/ +""" + +from pathlib import Path + +# 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/6.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-z(p$%wh6x^_9!1cgt%!s$w8k39(fox-^!iujxai42_wncja4%s' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'eumi__v4_project.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'eumi__v4_project.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/6.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/6.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/6.1/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/6.1/howto/static-files/ + +STATIC_URL = 'static/' + + +# Email +# https://docs.djangoproject.com/en/6.1/topics/email/#topic-email-configuration + +MAILERS = { + 'default': { + 'BACKEND': 'django.core.mail.backends.console.EmailBackend', + }, +} diff --git a/eumi__v4_project/urls.py b/eumi__v4_project/urls.py new file mode 100644 index 0000000..95d7856 --- /dev/null +++ b/eumi__v4_project/urls.py @@ -0,0 +1,22 @@ +""" +URL configuration for eumi__v4_project project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/6.1/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path + +urlpatterns = [ + path('admin/', admin.site.urls), +] diff --git a/eumi__v4_project/wsgi.py b/eumi__v4_project/wsgi.py new file mode 100644 index 0000000..32a11f4 --- /dev/null +++ b/eumi__v4_project/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for eumi__v4_project project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/6.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'eumi__v4_project.settings') + +application = get_wsgi_application() diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..7ede728 --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'eumi__v4_project.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/organigrama.pdf b/organigrama.pdf new file mode 100644 index 0000000..498a959 Binary files /dev/null and b/organigrama.pdf differ diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ae3b4cf --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +asgiref==3.12.1 +Django==6.1 +psycopg2-binary==2.9.12 +sqlparse==0.6.0