mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-02 05:53:15 -05:00
Feature/shareable recipes (#866)
* simplify context menu * move computed to comp-api * feat: ✨ create share tokens for recipes for sharing recieps to non-users * feat: ✨ shareable recipe links with og tags
This commit is contained in:
34
mealie/schema/recipe/recipe_share_token.py
Normal file
34
mealie/schema/recipe/recipe_share_token.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from fastapi_camelcase import CamelModel
|
||||
from pydantic import UUID4, Field
|
||||
|
||||
from .recipe import Recipe
|
||||
|
||||
|
||||
def defaut_expires_at_time() -> datetime:
|
||||
return datetime.utcnow() + timedelta(days=30)
|
||||
|
||||
|
||||
class RecipeShareTokenCreate(CamelModel):
|
||||
recipe_id: int
|
||||
expires_at: datetime = Field(default_factory=defaut_expires_at_time)
|
||||
|
||||
|
||||
class RecipeShareTokenSave(RecipeShareTokenCreate):
|
||||
group_id: UUID4
|
||||
|
||||
|
||||
class RecipeShareTokenSummary(RecipeShareTokenSave):
|
||||
id: UUID4
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class RecipeShareToken(RecipeShareTokenSummary):
|
||||
recipe: Recipe
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
Reference in New Issue
Block a user