reorganización docs

This commit is contained in:
devfzn 2023-10-12 14:14:02 -03:00
parent e22bb8f062
commit 4fb014786e
Signed by: devfzn
GPG Key ID: E070ECF4A754FDB1
31 changed files with 111 additions and 111 deletions

View File

@ -3,12 +3,12 @@
## Contenido ## Contenido
- [**Inicio**](./README.md) - [**Inicio**](./README.md)
- [User API](./01_user_api.md) - [User API](./docs/01_user_api.md)
- [Recipe API](./02_recipe_api.md) - [Recipe API](./docs/02_recipe_api.md)
- [Tag API](./03_tag_api.md) - [Tag API](./docs/03_tag_api.md)
- [Ingredient API](./04_ingredient_api.md) - [Ingredient API](./docs/04_ingredient_api.md)
- [Image API](./05_image_api.md) - [Image API](./docs/05_image_api.md)
- [Filters](./06_filters.md) - [Filters](./docs/06_filters.md)
<style>div.mermaid{text-align: center;}</style> <style>div.mermaid{text-align: center;}</style>
@ -643,12 +643,12 @@ este corriendo)*
### Docker services timeline ### Docker services timeline
![img](./imgs_readme/docker_services_timeline1.png) ![img](./docs/imgs_readme/docker_services_timeline1.png)
La **solución** es hace que Django espere a la base de datos `db`. Este chequea La **solución** es hace que Django espere a la base de datos `db`. Este chequea
la disponibilidad de la base de datos y continua cuando esta disponible la disponibilidad de la base de datos y continua cuando esta disponible
![img](./imgs_readme/docker_services_timeline2.png) ![img](./docs/imgs_readme/docker_services_timeline2.png)
Comando personalizado de administración de Django en app **core** Comando personalizado de administración de Django en app **core**
@ -818,9 +818,9 @@ class Ingredient(models.Model):
---- ----
- [**Inicio**](./README.md) - [**Inicio**](./README.md)
- [User API](./01_user_api.md) - [User API](./docs/01_user_api.md)
- [Recipe API](./02_recipe_api.md) - [Recipe API](./docs/02_recipe_api.md)
- [Tag API](./03_tag_api.md) - [Tag API](./docs/03_tag_api.md)
- [Ingredient API](./04_ingredient_api.md) - [Ingredient API](./docs/04_ingredient_api.md)
- [Image API](./05_image_api.md) - [Image API](./docs/05_image_api.md)
- [Filters](./06_filters.md) - [Filters](./docs/06_filters.md)

View File

@ -72,7 +72,7 @@
### Agregando Unitetst para el modelo usuario personalizado ### Agregando Unitetst para el modelo usuario personalizado
[test_models.py](./app/core/tests/tests_models.py) [test_models.py](../app/core/tests/tests_models.py)
```py ```py
from django.test import TestCase from django.test import TestCase
@ -93,7 +93,7 @@ class ModelTests(TestCase):
## Agregar usuario personalizado al proyecto ## Agregar usuario personalizado al proyecto
[models.py](./app/core/models.py) [models.py](../app/core/models.py)
```py ```py
from django.db import models from django.db import models
@ -149,7 +149,7 @@ Migrations for 'core':
- Create model User - Create model User
``` ```
Codigo autogenerado [0001_initial.py](./app/core/migrations/0001_initial.py) Codigo autogenerado [0001_initial.py](../app/core/migrations/0001_initial.py)
para app `core` para app `core`
Aplicar migraciones Aplicar migraciones
@ -221,7 +221,7 @@ Destroying test database for alias 'default'...
### Test normalize email addresses ### Test normalize email addresses
[test_models.py](./app/core/tests/test_models.py) [test_models.py](../app/core/tests/test_models.py)
```py ```py
def test_new_user_email_normalized(self): def test_new_user_email_normalized(self):
@ -237,7 +237,7 @@ Destroying test database for alias 'default'...
self.assertEqual(user.email, expected) self.assertEqual(user.email, expected)
``` ```
Modificar el `ceate_user` de [app/core/models.py](./app/core/models.py) Modificar el `ceate_user` de [app/core/models.py](../app/core/models.py)
para utilizar el método `normalize_email` que provee la clase **BaseUserManager** para utilizar el método `normalize_email` que provee la clase **BaseUserManager**
```diff ```diff
@ -249,7 +249,7 @@ para utilizar el método `normalize_email` que provee la clase **BaseUserManager
### Test requerir email ### Test requerir email
[test_models.py](./app/core/tests/test_models.py) [test_models.py](../app/core/tests/test_models.py)
```py ```py
def test_new_user_withouth_email_raises_error(self): def test_new_user_withouth_email_raises_error(self):
@ -258,7 +258,7 @@ para utilizar el método `normalize_email` que provee la clase **BaseUserManager
get_user_model().objects.create_user('', 'test123') get_user_model().objects.create_user('', 'test123')
``` ```
Modificar el `ceate_user` de [app/core/models.py](./app/core/models.py) Modificar el `ceate_user` de [app/core/models.py](../app/core/models.py)
y levantar excepción `ValueError` si usuario no ingresa un email y levantar excepción `ValueError` si usuario no ingresa un email
```py ```py
@ -275,7 +275,7 @@ y levantar excepción `ValueError` si usuario no ingresa un email
### Test creación de super usuario ### Test creación de super usuario
[test_models.py](./app/core/tests/test_models.py) [test_models.py](../app/core/tests/test_models.py)
```py ```py
def test_create_superuser(self): def test_create_superuser(self):
@ -289,7 +289,7 @@ y levantar excepción `ValueError` si usuario no ingresa un email
``` ```
Creación del método `create_superuser` para la clase `UserManager` en Creación del método `create_superuser` para la clase `UserManager` en
[app/core/models.py](./app/core/models.py) [app/core/models.py](../app/core/models.py)
```py ```py
def create_superuser(self, email, password): def create_superuser(self, email, password):
@ -324,7 +324,7 @@ Requiere muy poco cóidgo para ser usado
![img](./imgs_readme/django_admin_00.png) ![img](./imgs_readme/django_admin_00.png)
Se activa por modelo, en [`admin.py`](./app/core/admin.py) Se activa por modelo, en [`admin.py`](../app/core/admin.py)
### Personalización del administrador ### Personalización del administrador
@ -360,7 +360,7 @@ class UserAdmin(BaseUserAdmin):
### Creando test para el administrador ### Creando test para el administrador
[`app/core/tests/test_models.py`](./app/core/tests/test_admin.py) [`app/core/tests/test_models.py`](../app/core/tests/test_admin.py)
```py ```py
class AdminSiteTests(TestCase): class AdminSiteTests(TestCase):
@ -398,7 +398,7 @@ Correr test `docker compose run --rm app sh -c "python manage.py test"`
### Activar admin para core app ### Activar admin para core app
En [`admin.py`](./app/core/admin.py) En [`admin.py`](../app/core/admin.py)
```py ```py
from django.contrib import admin from django.contrib import admin
@ -473,7 +473,7 @@ admin.site.register(models.User, UserAdmin)
### Actualizar clase `UserAdmin` para que use los campos personalizados ### Actualizar clase `UserAdmin` para que use los campos personalizados
[app/core/admin.py](./app/core/admin.py) [app/core/admin.py](../app/core/admin.py)
```py ```py
class UserAdmin(BaseUserAdmin): class UserAdmin(BaseUserAdmin):
@ -644,7 +644,7 @@ Activar `user` app en `settings.py`
### Test User API ### Test User API
[`app/user/tests/test_user_api.py`](./app/user/tests/test_user_api.py) [`app/user/tests/test_user_api.py`](../app/user/tests/test_user_api.py)
```py ```py
CREATE_USER_URL = reverse('user:create') CREATE_USER_URL = reverse('user:create')
@ -704,7 +704,7 @@ class PublicUserApiTest(TestCase):
### Creando funcionalidad de User API ### Creando funcionalidad de User API
- [serializers.py](./app/user/serializers.py) - [serializers.py](../app/user/serializers.py)
```py ```py
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
@ -723,7 +723,7 @@ class PublicUserApiTest(TestCase):
return get_user_model().objects.create_user(**validated_data) return get_user_model().objects.create_user(**validated_data)
``` ```
- [views.py](./app/user/views.py) - [views.py](../app/user/views.py)
```py ```py
from rest_framework import generics from rest_framework import generics
@ -734,7 +734,7 @@ class PublicUserApiTest(TestCase):
serializer_class = UserSerializer serializer_class = UserSerializer
``` ```
- [urls.py](./app/user/urls.py) - [urls.py](../app/user/urls.py)
```py ```py
from django.urls import path from django.urls import path
@ -746,7 +746,7 @@ class PublicUserApiTest(TestCase):
] ]
``` ```
- [app/urls.py](./app/app/urls.py) - [app/urls.py](../app/app/urls.py)
```py ```py
... ...
@ -808,7 +808,7 @@ end
### Test token API ### Test token API
Agregar tests en Agregar tests en
[`app/user/tests/test_user_api.py`](./app/user/tests/test_user_api.py) [`app/user/tests/test_user_api.py`](../app/user/tests/test_user_api.py)
```py ```py
... ...
@ -860,7 +860,7 @@ class PublicUserApiTest(TestCase):
## Implementación Token API ## Implementación Token API
- Añadir app `rest_framework.authtoken` en [settings.py](./app/app/settings.py) - Añadir app `rest_framework.authtoken` en [settings.py](../app/app/settings.py)
```py ```py
INSTALLED_APPS = [ INSTALLED_APPS = [
@ -874,7 +874,7 @@ class PublicUserApiTest(TestCase):
### Creación del serlizador para token api ### Creación del serlizador para token api
- [user/serializer.py](./app/user/serializers.py) - [user/serializer.py](../app/user/serializers.py)
```py ```py
... ...
@ -904,7 +904,7 @@ class PublicUserApiTest(TestCase):
return attrs return attrs
``` ```
- vista [user/views.py](./app/user/views.py) - vista [user/views.py](../app/user/views.py)
```py ```py
... ...
@ -914,7 +914,7 @@ class PublicUserApiTest(TestCase):
renderer_classes = api_settings.DEFAULT_RENDERER_CLASSES renderer_classes = api_settings.DEFAULT_RENDERER_CLASSES
``` ```
- urls [user/urls.py](./app/user/urls.py) - urls [user/urls.py](../app/user/urls.py)
```py ```py
urlpatterns = [ urlpatterns = [
@ -925,7 +925,7 @@ class PublicUserApiTest(TestCase):
### Test administrar usuario ### Test administrar usuario
- [test_user_api.py](./app/user/tests/test_user_api.py) - [test_user_api.py](../app/user/tests/test_user_api.py)
```py ```py
... ...
@ -982,7 +982,7 @@ class PublicUserApiTest(TestCase):
`me` endpoint `me` endpoint
- creación (sobrescritura) del método update - creación (sobrescritura) del método update
[serializer.py](./app/user/serializers.py) [serializer.py](../app/user/serializers.py)
```py ```py
... ...
@ -1009,7 +1009,7 @@ class PublicUserApiTest(TestCase):
... ...
``` ```
- vistas [views.py](./app/user/views.py) - vistas [views.py](../app/user/views.py)
```py ```py
from rest_framework import generics, authentication, permissions from rest_framework import generics, authentication, permissions
@ -1026,7 +1026,7 @@ class PublicUserApiTest(TestCase):
return self.request.user return self.request.user
``` ```
- urls [urls.py](./app/user/urls.py) - urls [urls.py](../app/user/urls.py)
```py ```py
urlpatterns = [ urlpatterns = [
@ -1043,9 +1043,9 @@ Ruta `localhost:8000/api/docs`
---- ----
- [Inicio](./README.md) - [Inicio](../README.md)
- [**User API**](./01_user_api.md) - [**User API**](./01_user_api.md)
- [Recipe API](./02_recipe_api) - [Recipe API](./02_recipe_api.md)
- [Tag API](./03_tag_api.md) - [Tag API](./03_tag_api.md)
- [Ingredient API](./04_ingredient_api.md) - [Ingredient API](./04_ingredient_api.md)
- [Image API](./05_image_api.md) - [Image API](./05_image_api.md)

View File

@ -43,7 +43,7 @@ procesar estas peticiones
## Test Create Recipe ## Test Create Recipe
[core/tests/test_models.py](./app/core/tests/test_models.py) [core/tests/test_models.py](../app/core/tests/test_models.py)
```py ```py
from decimal import Decimal from decimal import Decimal
@ -74,7 +74,7 @@ class ModelTests(TestCase):
## Creación del modelo ## Creación del modelo
[`core/models.py`](./app/core/models.py) [`core/models.py`](../app/core/models.py)
```py ```py
... ...
@ -97,7 +97,7 @@ class Recipe(models.Model):
### Agregar al panel de administración ### Agregar al panel de administración
[`core/admin.py`](./app/core/admin.py) [`core/admin.py`](../app/core/admin.py)
```py ```py
... ...
@ -129,7 +129,7 @@ Migrations for 'core':
- Se crean directorio `reicpes/tests/` y su respecto `__init__.py` - Se crean directorio `reicpes/tests/` y su respecto `__init__.py`
- Añadir app `recipe` en [settings.py](./app/app/settings.py) - Añadir app `recipe` en [settings.py](../app/app/settings.py)
```py ```py
INSTALLED_APPS = [ INSTALLED_APPS = [
@ -140,7 +140,7 @@ Migrations for 'core':
### Tests recipe API ### Tests recipe API
[`recipe/tests/test_recipe_api.py`](./app/recipe/tests/test_recipe_api.py) [`recipe/tests/test_recipe_api.py`](../app/recipe/tests/test_recipe_api.py)
```py ```py
... ...
@ -216,7 +216,7 @@ class PrivateRecipeApiTests(TestCase):
### Serializador para Recetas ### Serializador para Recetas
[`recipe/serializer.py`](./app/recipe/serializers.py) [`recipe/serializer.py`](../app/recipe/serializers.py)
```py ```py
from rest_framework import serializers from rest_framework import serializers
@ -233,7 +233,7 @@ class RecipeSerializer(serializers.ModelSerializer):
### Vista Recetas ### Vista Recetas
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```py ```py
from rest_framework import viewsets from rest_framework import viewsets
@ -256,7 +256,7 @@ class RecipeViewSet(viewsets.ModelViewSet):
### URLs Recetas ### URLs Recetas
[`recipe/urls.py`](./app/recipe/urls.py) [`recipe/urls.py`](../app/recipe/urls.py)
```py ```py
from django.urls import path, include from django.urls import path, include
@ -273,7 +273,7 @@ urlpatterns = [
] ]
``` ```
[`app/urls.py`](./app/app/urls.py) [`app/urls.py`](../app/app/urls.py)
```py ```py
... ...
@ -286,7 +286,7 @@ urlpatterns = [
### Test detalles receta API ### Test detalles receta API
[`recipe/tests/test_recipe_api`](./app/recipe/tests/test_recipe_api.py) [`recipe/tests/test_recipe_api`](../app/recipe/tests/test_recipe_api.py)
```py ```py
... ...
@ -321,7 +321,7 @@ class PrivateRecipeApiTests(TestCase):
### Serializador para APIs detalles receta ### Serializador para APIs detalles receta
['recipe/serializer.py'](./app/recipe/serializers.py) ['recipe/serializer.py'](../app/recipe/serializers.py)
```py ```py
... ...
@ -340,7 +340,7 @@ Sobrescribiendo
para usar `RecipeDetailSerializer`. Se añade la lógica para que al listar se para usar `RecipeDetailSerializer`. Se añade la lógica para que al listar se
utilice `RecipeSerializer` utilice `RecipeSerializer`
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```py ```py
... ...
@ -358,7 +358,7 @@ class RecipeViewSet(viewsets.ModelViewSet):
### Test creación de receta a travez de la API ### Test creación de receta a travez de la API
[`test_recipe_api.py`](./app/recipe/tests/test_recipe_api.py) [`test_recipe_api.py`](../app/recipe/tests/test_recipe_api.py)
```py ```py
class PrivateRecipeApiTests(TestCase): class PrivateRecipeApiTests(TestCase):
@ -385,7 +385,7 @@ Se hace la Comparación utilizando el método
### Implementación de vista para creación de receta ### Implementación de vista para creación de receta
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```py ```py
... ...
@ -399,7 +399,7 @@ Se hace la Comparación utilizando el método
### Refactorizando test_recipe_api ### Refactorizando test_recipe_api
[`test_recipe_api.py`](./app/recipe/tests/test_recipe_api.py) [`test_recipe_api.py`](../app/recipe/tests/test_recipe_api.py)
```diff ```diff
... ...
@ -539,7 +539,7 @@ URL `localhost:8000/api/docs/`
---- ----
- [Inicio](./README.md) - [Inicio](../README.md)
- [User API](./01_user_api.md) - [User API](./01_user_api.md)
- [**Recipe API**](./02_recipe_api.md) - [**Recipe API**](./02_recipe_api.md)
- [Tag API](./03_tag_api.md) - [Tag API](./03_tag_api.md)

View File

@ -19,7 +19,7 @@
## Test Tag Model ## Test Tag Model
[`core/tests/test_models.py`](./app/core/tests/test_models.py) [`core/tests/test_models.py`](../app/core/tests/test_models.py)
```py ```py
... ...
@ -42,7 +42,7 @@ def create_user(email='user@example.com', password='testpass123'):
- `name` Nombre del tag a crear - `name` Nombre del tag a crear
- `user` Usuario creador/dueño del tag - `user` Usuario creador/dueño del tag
[`core/models.py`](./app/core/models.py) [`core/models.py`](../app/core/models.py)
```py ```py
... ...
@ -99,7 +99,7 @@ admin.site.register(models.Tag)
## Test tags API ## Test tags API
[`recipe/tests/test_tags_api.py`](./app/recipe/tests/test_tags_api.py) [`recipe/tests/test_tags_api.py`](../app/recipe/tests/test_tags_api.py)
```py ```py
... ...
@ -159,7 +159,7 @@ class PrivateTagsApiTests(TestCase):
### Serializador Tag API ### Serializador Tag API
[`recipe/serializers.py`](./app/recipe/serializers.py) [`recipe/serializers.py`](../app/recipe/serializers.py)
```py ```py
... ...
@ -175,7 +175,7 @@ class TagSerializer(serializers.ModelSerializer):
### Views tags APIs ### Views tags APIs
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```py ```py
... ...
@ -194,7 +194,7 @@ class TagViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
### URLS tags APIs ### URLS tags APIs
[`recipe/urls.py`](./app/recipe/urls.py) [`recipe/urls.py`](../app/recipe/urls.py)
```py ```py
... ...
@ -207,7 +207,7 @@ router.register('tags', views.TagViewSet)
### Test Update Tags ### Test Update Tags
[`test_tags_api.py`](./app/recipe/tests/test_tags_api.py) [`test_tags_api.py`](../app/recipe/tests/test_tags_api.py)
```py ```py
... ...
@ -235,7 +235,7 @@ class PrivateTagsApiTests(TestCase):
### Implementación update tag ### Implementación update tag
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```py ```py
-class TagViewSet(mixins.ListModelMixin, viewsets.GenericViewSet): -class TagViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
@ -251,7 +251,7 @@ class PrivateTagsApiTests(TestCase):
### Test Deleting tags ### Test Deleting tags
[`test_tags_api.py`](./app/recipe/tests/test_tags_api.py) [`test_tags_api.py`](../app/recipe/tests/test_tags_api.py)
```py ```py
def test_delete_tag(self): def test_delete_tag(self):
@ -268,7 +268,7 @@ def test_delete_tag(self):
### Implementación borrar tag ### Implementación borrar tag
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```py ```py
-class TagViewSet(mixins.UpdateModelMixin, -class TagViewSet(mixins.UpdateModelMixin,
@ -316,7 +316,7 @@ class RecipeSerializer(serializers.Serializer):
### Test crear tags a travez de la API recetas ### Test crear tags a travez de la API recetas
[`tests/test_recipe_api.py`](./app/recipe/tests/test_recipe_api.py) [`tests/test_recipe_api.py`](../app/recipe/tests/test_recipe_api.py)
```py ```py
from core.models import Tag from core.models import Tag
@ -372,7 +372,7 @@ from core.models import Tag
### Implementación creación de Tags al crear recetas ### Implementación creación de Tags al crear recetas
[recipe/serializers.py](./app/recipe/serializers.py) [recipe/serializers.py](../app/recipe/serializers.py)
```py ```py
... ...
@ -415,7 +415,7 @@ class RecipeSerializer(serializers.ModelSerializer):
### Test modificar tag asignado a receta ### Test modificar tag asignado a receta
[`recipe/tests/test_recipe_api.py`](./app/recipe/tests/test_recipe_api.py) [`recipe/tests/test_recipe_api.py`](../app/recipe/tests/test_recipe_api.py)
```py ```py
... ...
@ -463,7 +463,7 @@ class RecipeSerializer(serializers.ModelSerializer):
### Implementación modificar tag asignado a receta ### Implementación modificar tag asignado a receta
[`recipe/serializer.py`](./app/recipe/serializers.py) [`recipe/serializer.py`](../app/recipe/serializers.py)
```py ```py
... ...
@ -517,7 +517,7 @@ URL `localhost:8000/api/docs`
---- ----
- [Inicio](./README.md) - [Inicio](../README.md)
- [User API](./01_user_api.md) - [User API](./01_user_api.md)
- [Recipe API](./02_recipe_api.md) - [Recipe API](./02_recipe_api.md)
- [**Tag API**](./03_tag_api.md) - [**Tag API**](./03_tag_api.md)

View File

@ -35,7 +35,7 @@
## Test Tag Model ## Test Tag Model
[`tests/test_models.py`](./app/core/tests/test_models.py) [`tests/test_models.py`](../app/core/tests/test_models.py)
```py ```py
... ...
@ -56,7 +56,7 @@
- `name` Nombre del ingrediente a crear - `name` Nombre del ingrediente a crear
- `user` Usuario creador/dueño del ingrediente - `user` Usuario creador/dueño del ingrediente
[`core/models.py`](./app/core/models.py) [`core/models.py`](../app/core/models.py)
```py ```py
... ...
@ -93,7 +93,7 @@ Migrations for 'core':
### Agregar al administrador de django ### Agregar al administrador de django
[`app/core/admin.py`](./app/core/admin.py) [`app/core/admin.py`](../app/core/admin.py)
```py ```py
admin.site.register(models.Ingredient) admin.site.register(models.Ingredient)
@ -101,7 +101,7 @@ admin.site.register(models.Ingredient)
## Test para listar ingredientes ## Test para listar ingredientes
[`tests/test_ingredients_api.py`](./app/core/tests/test_ingredients_api.py) [`tests/test_ingredients_api.py`](../app/core/tests/test_ingredients_api.py)
```py ```py
... ...
@ -160,7 +160,7 @@ class PrivateIngredientsApiTests(TestCase):
### Serializador Ingredientes ### Serializador Ingredientes
[`recipe/serializers.py`](./app/recipe/serializers.py) [`recipe/serializers.py`](../app/recipe/serializers.py)
```py ```py
... ...
@ -179,7 +179,7 @@ class RecipeSerializer(serializers.ModelSerializer):
### Vistas Ingredients ### Vistas Ingredients
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```py ```py
class IngredientViewSet(mixin.ListModelMixin, viewsets.GenericViewSet): class IngredientViewSet(mixin.ListModelMixin, viewsets.GenericViewSet):
@ -196,7 +196,7 @@ class IngredientViewSet(mixin.ListModelMixin, viewsets.GenericViewSet):
### URls Ingredientes ### URls Ingredientes
[recipe/urls.py](./app/recipe/urls.py) [recipe/urls.py](../app/recipe/urls.py)
```py ```py
... ...
@ -209,7 +209,7 @@ router.register('ingredients', views.IngredientViewSet)
### Test actualizar ingredientes ### Test actualizar ingredientes
[`recipe/tests/test_ingredients_api.py`](./app/recipe/tests/test_ingredients_api.py) [`recipe/tests/test_ingredients_api.py`](../app/recipe/tests/test_ingredients_api.py)
```py ```py
... ...
@ -234,7 +234,7 @@ def detail_url(ingredient_id):
### Implementar funcionalidad actualizar ingredientes ### Implementar funcionalidad actualizar ingredientes
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```diff ```diff
-class IngredientViewSet(mixins.ListModelMixin, viewsets.GenericViewSet): -class IngredientViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
@ -247,7 +247,7 @@ def detail_url(ingredient_id):
### Test eliminar ingredientes ### Test eliminar ingredientes
[`test_ingredients_api.py`](./app/recipe/tests/test_ingredients_api.py) [`test_ingredients_api.py`](../app/recipe/tests/test_ingredients_api.py)
```py ```py
def test_delete_ingredient(self): def test_delete_ingredient(self):
@ -264,7 +264,7 @@ def detail_url(ingredient_id):
### Implementar funcionalidad actualizar ingredientes ### Implementar funcionalidad actualizar ingredientes
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```diff ```diff
-class IngredientViewSet( -class IngredientViewSet(
@ -278,7 +278,7 @@ def detail_url(ingredient_id):
### Test crear ingrediente ### Test crear ingrediente
[`test_recipe_api.py`](./app/recipe/tests/test_recipe_api.py) [`test_recipe_api.py`](../app/recipe/tests/test_recipe_api.py)
```py ```py
def test_create_recipe_with_new_ingredients(self): def test_create_recipe_with_new_ingredients(self):
@ -328,7 +328,7 @@ def detail_url(ingredient_id):
### Implementación funcionalidad crear ingredientes con receta ### Implementación funcionalidad crear ingredientes con receta
[`recipe/serializers.py`](./app/recipe/serializers.py) [`recipe/serializers.py`](../app/recipe/serializers.py)
```diff ```diff
... ...
@ -371,7 +371,7 @@ class RecipeSerializer(serializers.ModelSerializer):
### Test actaulizar ingredientes ### Test actaulizar ingredientes
[`recipe/tests/test_ingredients_api.py`](./app/recipe/tests/test_ingredients_api.py) [`recipe/tests/test_ingredients_api.py`](../app/recipe/tests/test_ingredients_api.py)
```py ```py
def test_create_ingredient_on_update(self): def test_create_ingredient_on_update(self):
@ -417,7 +417,7 @@ class RecipeSerializer(serializers.ModelSerializer):
### Implementación actualizar ingredientes ### Implementación actualizar ingredientes
[`recipe/serializers.py`](./app/recipe/serializers.py) [`recipe/serializers.py`](../app/recipe/serializers.py)
```diff ```diff
def create(self, validated_data): def create(self, validated_data):
@ -454,7 +454,7 @@ TDD facilita esta labor, corriendo los tests para evaluar
`TagViewSet/IngredientViewSet` Código muy similar, refactorización usando `TagViewSet/IngredientViewSet` Código muy similar, refactorización usando
herencia herencia
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```diff ```diff
+ class BaseRecipeAtrrViewSet(mixins.DestroyModelMixin, + class BaseRecipeAtrrViewSet(mixins.DestroyModelMixin,
@ -509,7 +509,7 @@ herencia
---- ----
- [Inicio](./README.md) - [Inicio](../README.md)
- [User API](./01_user_api.md) - [User API](./01_user_api.md)
- [Recipe API](./02_recipe_api.md) - [Recipe API](./02_recipe_api.md)
- [Tag API](./03_tag_api.md) - [Tag API](./03_tag_api.md)

View File

@ -19,7 +19,7 @@
- zlib1g, zlib1g-dev - zlib1g, zlib1g-dev
- libjpeg-dev - libjpeg-dev
[Dockerfile](./Dockerfile) [Dockerfile](../Dockerfile)
```diff ```diff
... ...
@ -35,7 +35,7 @@
... ...
``` ```
[`requirements.txt`](./requirements.txt) [`requirements.txt`](../requirements.txt)
```txt ```txt
Django==4.2.5 Django==4.2.5
@ -161,7 +161,7 @@ directorio `STATIC_ROOT` especificado en `settings.py`
Subdirectorio para manejar archivos Subdirectorio para manejar archivos
[`Dockerfile`](./Dockerfile) [`Dockerfile`](../Dockerfile)
```diff ```diff
... ...
@ -178,7 +178,7 @@ Subdirectorio para manejar archivos
... ...
``` ```
[`docker-compose`](./docker-compose.yml) [`docker-compose`](../docker-compose.yml)
```diff ```diff
... ...
@ -198,7 +198,7 @@ EOF
### Actualizar `setttings.py` ### Actualizar `setttings.py`
[`settings.py`](./app/app/settings.py) [`settings.py`](../app/app/settings.py)
```diff ```diff
- STATIC_URL = 'static/' - STATIC_URL = 'static/'
@ -211,7 +211,7 @@ EOF
### Actualizar `app/urls.py` ### Actualizar `app/urls.py`
[`app/urls.py`](./app/app/urls.py) [`app/urls.py`](../app/app/urls.py)
```diff ```diff
... ...
@ -229,7 +229,7 @@ EOF
## Test agregar campo imagen en el modelo de receta ## Test agregar campo imagen en el modelo de receta
[`test_models.py`](./app/core/tests/test_models.py) [`test_models.py`](../app/core/tests/test_models.py)
```py ```py
from unittest.mock import patch from unittest.mock import patch
@ -249,7 +249,7 @@ from unittest.mock import patch
## Implementación imagen en el modelo ## Implementación imagen en el modelo
[`models.py`](./app/core/models.py) [`models.py`](../app/core/models.py)
```py ```py
import uuid import uuid
@ -292,7 +292,7 @@ Migrations for 'core':
### Test cargar/subir imagen ### Test cargar/subir imagen
[`test_recipe_api.py`](./app/recipe/tests/test_recipe_api.py) [`test_recipe_api.py`](../app/recipe/tests/test_recipe_api.py)
```py ```py
import tempfile import tempfile
@ -353,7 +353,7 @@ Implementación de la funcionalidad para subir imagenes a travez de
### Serializador imagen receta ### Serializador imagen receta
[`serializers.py`](./app/recipe/serializers.py) [`serializers.py`](../app/recipe/serializers.py)
```py ```py
class RecipeImageSerializer(serializers.ModelSerializer): class RecipeImageSerializer(serializers.ModelSerializer):
@ -368,7 +368,7 @@ class RecipeImageSerializer(serializers.ModelSerializer):
### Vista imagen receta ### Vista imagen receta
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```diff ```diff
from rest_framework import ( from rest_framework import (
@ -406,7 +406,7 @@ class RecipeImageSerializer(serializers.ModelSerializer):
``` ```
Para subir imagenes a travez de la interfaz web establecer la sgte. Para subir imagenes a travez de la interfaz web establecer la sgte.
configuración en [`settings.py`](./app/app/settings.py) configuración en [`settings.py`](../app/app/settings.py)
```py ```py
SPECTACULAR_SETTINGS = { SPECTACULAR_SETTINGS = {
@ -416,7 +416,7 @@ SPECTACULAR_SETTINGS = {
### Incluir imagen en detalle receta ### Incluir imagen en detalle receta
[`serializers.py`](./app/recipe/serializers.py) [`serializers.py`](../app/recipe/serializers.py)
```py ```py
class RecipeDetailSerializer(RecipeSerializer): class RecipeDetailSerializer(RecipeSerializer):
@ -440,7 +440,7 @@ Levantar aplicación `docker compose up` y visitar `locahost:8000/api/docs`
---- ----
- [Inicio](./README.md) - [Inicio](../README.md)
- [User API](./01_user_api.md) - [User API](./01_user_api.md)
- [Recipe API](./02_recipe_api.md) - [Recipe API](./02_recipe_api.md)
- [Tag API](./03_tag_api.md) - [Tag API](./03_tag_api.md)

View File

@ -48,7 +48,7 @@ elegir
## Test filtros ## Test filtros
[`test_recipe_api.py`](./app/recipe/tests/test_recipe_api.py) [`test_recipe_api.py`](../app/recipe/tests/test_recipe_api.py)
```py ```py
class PrivateRecipeApiTests(TestCase): class PrivateRecipeApiTests(TestCase):
@ -99,7 +99,7 @@ class PrivateRecipeApiTests(TestCase):
## Implementación filtros ## Implementación filtros
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```py ```py
from drf_spectacular.types import OpenApiTypes from drf_spectacular.types import OpenApiTypes
@ -153,7 +153,7 @@ class RecipeViewSet(viewsets.ModelViewSet):
## Test para filtrar por tags e ingredientes ## Test para filtrar por tags e ingredientes
[`test_ingredients_api.py`](./app/recipe/tests/test_ingredients_api.py) [`test_ingredients_api.py`](../app/recipe/tests/test_ingredients_api.py)
```py ```py
from decimal import Decimal from decimal import Decimal
@ -203,7 +203,7 @@ from core.model import Recipe
self.assertEqual(len(res.data), 1) self.assertEqual(len(res.data), 1)
``` ```
[`test_tags_api.py`](./app/recipe/tests/test_tags_api.py) [`test_tags_api.py`](../app/recipe/tests/test_tags_api.py)
```py ```py
from decimal import Decimal from decimal import Decimal
@ -255,7 +255,7 @@ from core.model import Recipe
## Implementación filtrado por tags e ingredientes ## Implementación filtrado por tags e ingredientes
[`recipe/views.py`](./app/recipe/views.py) [`recipe/views.py`](../app/recipe/views.py)
```py ```py
@extend_schema_view( @extend_schema_view(
@ -293,7 +293,7 @@ class BaseRecipeAtrrViewSet(mixins.DestroyModelMixin,
---- ----
- [**Inicio**](./README.md) - [**Inicio**](../README.md)
- [User API](./01_user_api.md) - [User API](./01_user_api.md)
- [Recipe API](./02_recipe_api.md) - [Recipe API](./02_recipe_api.md)
- [Tag API](./03_tag_api.md) - [Tag API](./03_tag_api.md)

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

View File

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 173 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 83 KiB

View File

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

View File

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

View File

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 122 KiB