Basic game creating API (#2)
* Adding the base of our API * Little file and lint adjustments * Adding the lint command to Makefile * Adding the Minesweeper logic for game creation * Adding some tests for the Minesweeper algorithm * Adding some tools command to Makefile like pre-commit and pip-tools * Adding test help text to Makefile * all new user is_staff=True, for development for now * Now we can get the data from specific game Adding game status Adding game status Fixing game models
This commit is contained in:
65
game/migrations/0001_initial.py
Normal file
65
game/migrations/0001_initial.py
Normal file
@@ -0,0 +1,65 @@
|
||||
# Generated by Django 3.1.3 on 2020-11-05 03:03
|
||||
|
||||
from django.db import migrations, models
|
||||
import django_mysql.models
|
||||
import internal.utils
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Game",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.AutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"created_at",
|
||||
models.DateTimeField(
|
||||
auto_now_add=True, verbose_name="Creation date"
|
||||
),
|
||||
),
|
||||
(
|
||||
"modified_at",
|
||||
models.DateTimeField(auto_now=True, verbose_name="Last update"),
|
||||
),
|
||||
(
|
||||
"rows",
|
||||
models.PositiveIntegerField(default=10, verbose_name="Board rows"),
|
||||
),
|
||||
(
|
||||
"cols",
|
||||
models.PositiveIntegerField(default=10, verbose_name="Board cols"),
|
||||
),
|
||||
(
|
||||
"mines",
|
||||
models.PositiveIntegerField(
|
||||
default=5, verbose_name="Mines on board"
|
||||
),
|
||||
),
|
||||
(
|
||||
"board",
|
||||
django_mysql.models.JSONField(
|
||||
default=internal.utils.empty_list,
|
||||
verbose_name="Generated board",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Game",
|
||||
"verbose_name_plural": "Games",
|
||||
"db_table": "games",
|
||||
},
|
||||
),
|
||||
]
|
||||
68
game/migrations/0002_auto_20201106_0225.py
Normal file
68
game/migrations/0002_auto_20201106_0225.py
Normal file
@@ -0,0 +1,68 @@
|
||||
# Generated by Django 3.1.3 on 2020-11-06 02:25
|
||||
|
||||
from django.db import migrations, models
|
||||
import django_mysql.models
|
||||
import game.models
|
||||
import internal.utils
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("game", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="game",
|
||||
name="status",
|
||||
field=models.IntegerField(
|
||||
choices=[(0, "NOT_PLAYED"), (1, "PLAYING"), (2, "FINISHED")],
|
||||
default=game.models.GameStatuses["NOT_PLAYED"],
|
||||
help_text="Actual game status",
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="game",
|
||||
name="win",
|
||||
field=models.BooleanField(
|
||||
blank=True,
|
||||
default=None,
|
||||
help_text="Did the user win the game?",
|
||||
null=True,
|
||||
verbose_name="Win?",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="game",
|
||||
name="board",
|
||||
field=django_mysql.models.JSONField(
|
||||
default=internal.utils.empty_list,
|
||||
help_text="Whe generated board game",
|
||||
verbose_name="Generated board",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="game",
|
||||
name="cols",
|
||||
field=models.PositiveIntegerField(
|
||||
default=10, help_text="Board's total columns", verbose_name="Board cols"
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="game",
|
||||
name="mines",
|
||||
field=models.PositiveIntegerField(
|
||||
default=5,
|
||||
help_text="Board's total placed mines",
|
||||
verbose_name="Mines on board",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="game",
|
||||
name="rows",
|
||||
field=models.PositiveIntegerField(
|
||||
default=10, help_text="Board's total rows", verbose_name="Board rows"
|
||||
),
|
||||
),
|
||||
]
|
||||
0
game/migrations/__init__.py
Normal file
0
game/migrations/__init__.py
Normal file
Reference in New Issue
Block a user