rename draft to unlisted
This commit is contained in:
@@ -53,8 +53,7 @@ class Course(BaseModel):
|
||||
name: str
|
||||
access_period: int
|
||||
cert: Cert
|
||||
draft: bool = False
|
||||
demo: bool = False
|
||||
unlisted: bool = False
|
||||
rawfile: bytes | None = None
|
||||
|
||||
|
||||
@@ -88,7 +87,7 @@ def put_course(course_id: str):
|
||||
update_expr='SET #name = :name, \
|
||||
access_period = :access_period, \
|
||||
cert = :cert, \
|
||||
draft = :draft, \
|
||||
unlisted = :unlisted, \
|
||||
updated_at = :updated_at',
|
||||
expr_attr_names={
|
||||
'#name': 'name',
|
||||
@@ -97,7 +96,7 @@ def put_course(course_id: str):
|
||||
':name': course.name,
|
||||
':cert': course.cert.model_dump(),
|
||||
':access_period': course.access_period,
|
||||
':draft': course.draft,
|
||||
':unlisted': course.unlisted,
|
||||
':updated_at': now(),
|
||||
},
|
||||
cond_expr='attribute_exists(sk)',
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
from typing import Annotated
|
||||
|
||||
from aws_lambda_powertools.event_handler.api_gateway import Router
|
||||
from aws_lambda_powertools.event_handler.exceptions import (
|
||||
NotFoundError,
|
||||
)
|
||||
from aws_lambda_powertools.event_handler.openapi.params import Body
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
|
||||
from layercake.extra_types import CpfStr, NameStr
|
||||
|
||||
from boto3clients import dynamodb_client
|
||||
from config import USER_TABLE
|
||||
@@ -23,3 +27,11 @@ def get_user(user_id: str):
|
||||
KeyPair(user_id, '0'),
|
||||
exc_cls=NotFoundError,
|
||||
)
|
||||
|
||||
|
||||
@router.patch('/<user_id>')
|
||||
def update(
|
||||
user_id: str,
|
||||
name: Annotated[NameStr, Body(embed=True)],
|
||||
cpf: Annotated[CpfStr, Body(embed=True)],
|
||||
): ...
|
||||
|
||||
Reference in New Issue
Block a user