diff --git a/ai/__pycache__/__init__.cpython-311.pyc b/ai/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 0000000..9beeae7 Binary files /dev/null and b/ai/__pycache__/__init__.cpython-311.pyc differ diff --git a/ai/__pycache__/local_ai_api.cpython-311.pyc b/ai/__pycache__/local_ai_api.cpython-311.pyc new file mode 100644 index 0000000..ae12bda Binary files /dev/null and b/ai/__pycache__/local_ai_api.cpython-311.pyc differ diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index 96bce55..77800c6 100644 Binary files a/config/__pycache__/settings.cpython-311.pyc and b/config/__pycache__/settings.cpython-311.pyc differ diff --git a/config/__pycache__/urls.cpython-311.pyc b/config/__pycache__/urls.cpython-311.pyc index 0b85e94..c56ff4a 100644 Binary files a/config/__pycache__/urls.cpython-311.pyc and b/config/__pycache__/urls.cpython-311.pyc differ diff --git a/config/settings.py b/config/settings.py index 291d043..87bab3e 100644 --- a/config/settings.py +++ b/config/settings.py @@ -180,3 +180,7 @@ if EMAIL_USE_SSL: # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +MEDIA_URL = '/media/' +MEDIA_ROOT = os.path.join(BASE_DIR, 'media') + diff --git a/config/urls.py b/config/urls.py index bcfc074..b5bd462 100644 --- a/config/urls.py +++ b/config/urls.py @@ -1,29 +1,13 @@ -""" -URL configuration for config project. - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/5.2/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 include, path from django.conf import settings from django.conf.urls.static import static urlpatterns = [ - path("admin/", admin.site.urls), + # path("admin/", admin.site.urls), # User requested to remove standard login path("", include("core.urls")), ] if settings.DEBUG: - urlpatterns += static("/assets/", document_root=settings.BASE_DIR / "assets") - urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) \ No newline at end of file diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index e061640..505bc48 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 5a69659..e4054c9 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 2a36fd6..c371fb2 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..a44c770 --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# Generated by Django 5.2.7 on 2026-02-13 21:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='GameProject', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=255)), + ('description', models.TextField(blank=True)), + ('prompt', models.TextField()), + ('genre', models.CharField(choices=[('platformer', 'Platformer'), ('shooter', 'Top-Down Shooter'), ('runner', 'Endless Runner'), ('puzzle', 'Puzzle')], default='platformer', max_length=50)), + ('image_reference', models.ImageField(blank=True, null=True, upload_to='game_references/')), + ('config_json', models.JSONField(blank=True, default=dict)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ], + ), + ] diff --git a/core/migrations/0002_adminconfig_rentaloption_usersession_and_more.py b/core/migrations/0002_adminconfig_rentaloption_usersession_and_more.py new file mode 100644 index 0000000..8ebe9ae --- /dev/null +++ b/core/migrations/0002_adminconfig_rentaloption_usersession_and_more.py @@ -0,0 +1,59 @@ +# Generated by Django 5.2.7 on 2026-02-13 22:23 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='AdminConfig', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('private_key', models.CharField(max_length=255, unique=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ], + ), + migrations.CreateModel( + name='RentalOption', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=100)), + ('description', models.TextField(blank=True)), + ('duration_days', models.IntegerField(default=1)), + ('price', models.DecimalField(decimal_places=2, max_digits=10)), + ('qr_code_1', models.ImageField(blank=True, null=True, upload_to='qr_codes/')), + ('qr_code_2', models.ImageField(blank=True, null=True, upload_to='qr_codes/')), + ], + ), + migrations.CreateModel( + name='UserSession', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('access_code', models.CharField(max_length=6, unique=True)), + ('phone_number', models.CharField(blank=True, max_length=20, null=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ], + ), + migrations.AddField( + model_name='gameproject', + name='is_active', + field=models.BooleanField(default=True), + ), + migrations.CreateModel( + name='UserPurchase', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('purchased_at', models.DateTimeField(auto_now_add=True)), + ('expires_at', models.DateTimeField()), + ('game', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.gameproject')), + ('rental_option', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.rentaloption')), + ('user_session', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.usersession')), + ], + ), + ] diff --git a/core/migrations/0003_gameproject_script_code_and_more.py b/core/migrations/0003_gameproject_script_code_and_more.py new file mode 100644 index 0000000..983eabd --- /dev/null +++ b/core/migrations/0003_gameproject_script_code_and_more.py @@ -0,0 +1,33 @@ +# Generated by Django 5.2.7 on 2026-02-14 01:00 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0002_adminconfig_rentaloption_usersession_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='gameproject', + name='script_code', + field=models.TextField(blank=True, help_text='HTML/JS/CSS code for the game'), + ), + migrations.AddField( + model_name='userpurchase', + name='confirmation_code', + field=models.CharField(blank=True, max_length=12, null=True), + ), + migrations.AddField( + model_name='userpurchase', + name='is_confirmed', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='gameproject', + name='genre', + field=models.CharField(choices=[('platformer', 'Platformer'), ('shooter', 'Top-Down Shooter'), ('runner', 'Endless Runner'), ('puzzle', 'Puzzle'), ('traditional', 'Traditional Script')], default='platformer', max_length=50), + ), + ] diff --git a/core/migrations/__pycache__/0001_initial.cpython-311.pyc b/core/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..6208d0b Binary files /dev/null and b/core/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/core/migrations/__pycache__/0002_adminconfig_rentaloption_usersession_and_more.cpython-311.pyc b/core/migrations/__pycache__/0002_adminconfig_rentaloption_usersession_and_more.cpython-311.pyc new file mode 100644 index 0000000..bd7c8ab Binary files /dev/null and b/core/migrations/__pycache__/0002_adminconfig_rentaloption_usersession_and_more.cpython-311.pyc differ diff --git a/core/migrations/__pycache__/0003_gameproject_script_code_and_more.cpython-311.pyc b/core/migrations/__pycache__/0003_gameproject_script_code_and_more.cpython-311.pyc new file mode 100644 index 0000000..f3c5b84 Binary files /dev/null and b/core/migrations/__pycache__/0003_gameproject_script_code_and_more.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 71a8362..60d6bbd 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,67 @@ from django.db import models +from django.utils import timezone +import datetime -# Create your models here. +class AdminConfig(models.Model): + private_key = models.CharField(max_length=255, unique=True) + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return "Admin Configuration" + +class UserSession(models.Model): + access_code = models.CharField(max_length=6, unique=True) + phone_number = models.CharField(max_length=20, blank=True, null=True) + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f"User {self.access_code}" + +class GameProject(models.Model): + GENRE_CHOICES = [ + ('platformer', 'Platformer'), + ('shooter', 'Top-Down Shooter'), + ('runner', 'Endless Runner'), + ('puzzle', 'Puzzle'), + ('traditional', 'Traditional Script'), + ] + + title = models.CharField(max_length=255) + description = models.TextField(blank=True) + prompt = models.TextField() + genre = models.CharField(max_length=50, choices=GENRE_CHOICES, default='platformer') + image_reference = models.ImageField(upload_to='game_references/', null=True, blank=True) + config_json = models.JSONField(default=dict, blank=True) + script_code = models.TextField(blank=True, help_text="HTML/JS/CSS code for the game") + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + is_active = models.BooleanField(default=True) + + def __str__(self): + return self.title + +class RentalOption(models.Model): + title = models.CharField(max_length=100) + description = models.TextField(blank=True) + duration_days = models.IntegerField(default=1) + price = models.DecimalField(max_digits=10, decimal_places=2) + qr_code_1 = models.ImageField(upload_to='qr_codes/', blank=True, null=True) + qr_code_2 = models.ImageField(upload_to='qr_codes/', blank=True, null=True) + + def __str__(self): + return f"{self.title} - {self.price}" + +class UserPurchase(models.Model): + user_session = models.ForeignKey(UserSession, on_delete=models.CASCADE) + game = models.ForeignKey(GameProject, on_delete=models.CASCADE) + rental_option = models.ForeignKey(RentalOption, on_delete=models.CASCADE) + confirmation_code = models.CharField(max_length=12, blank=True, null=True) + purchased_at = models.DateTimeField(auto_now_add=True) + expires_at = models.DateTimeField() + is_confirmed = models.BooleanField(default=False) + + def is_valid(self): + return self.is_confirmed and timezone.now() < self.expires_at + + def __str__(self): + return f"{self.user_session.access_code} - {self.game.title}" \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..4ab3a6b 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,25 +1,97 @@ +{% load static %} - - +
- -| Título | +Gênero | +Data | +Status | +Ações | +
|---|---|---|---|---|
| {{ project.title }} | +{{ project.get_genre_display }} | +{{ project.created_at|date:"d/m/Y" }} | ++ {% if project.is_active %} + Ativo + {% else %} + Inativo + {% endif %} + | ++ Editar + Excluir + | +
Edite os preços e QR Codes para aluguel de tempo.
+Insira sua Chave Privada única para gerenciar a plataforma.
+ +Escolha um título e alugue tempo para jogar instantaneamente.
+{{ project.prompt|truncatewords:20 }}
+ ALUGAR TEMPO +Nenhum jogo disponível no momento.
+Acesse os melhores jogos gerados por IA. Gere seu código de acesso único e comece a jogar agora.
AppWizzy AI is collecting your requirements and applying the first changes.
-This page will refresh automatically as the plan is implemented.
-
- Runtime: Django {{ django_version }} · Python {{ python_version }}
- — UTC {{ current_time|date:"Y-m-d H:i:s" }}
-
Sessão validada. Divirta-se!
+Este jogo ainda não possui script. Exibindo simulador.
+{{ game.prompt }}
+{{ game.prompt }}
+Escolha um plano ao lado para começar.
+Clique para visualizar os códigos de pagamento
+