Compare commits
10 Commits
154aadb6b7
...
f86396107d
| Author | SHA1 | Date | |
|---|---|---|---|
| f86396107d | |||
| c581fa5e1c | |||
| 4310623ece | |||
| 7e81f6ed88 | |||
| d5be5d1c40 | |||
| 20491c8113 | |||
| c3ac8cd83f | |||
| abc9e94104 | |||
| 167b1becbc | |||
|
|
daedc67e7a |
@ -3,7 +3,7 @@ steps:
|
|||||||
name: Build & Push Frontend
|
name: Build & Push Frontend
|
||||||
image: woodpeckerci/plugin-kaniko
|
image: woodpeckerci/plugin-kaniko
|
||||||
when:
|
when:
|
||||||
branch: [ master, develop ]
|
branch: [ master, develop, aws ]
|
||||||
event: [ push, pull_request, tag ]
|
event: [ push, pull_request, tag ]
|
||||||
path:
|
path:
|
||||||
include: [ frontend/** ]
|
include: [ frontend/** ]
|
||||||
@ -24,7 +24,7 @@ steps:
|
|||||||
name: Build & Push Backend
|
name: Build & Push Backend
|
||||||
image: woodpeckerci/plugin-kaniko
|
image: woodpeckerci/plugin-kaniko
|
||||||
when:
|
when:
|
||||||
branch: [ master, develop ]
|
branch: [ master, develop, aws ]
|
||||||
event: [ push, pull_request, tag ]
|
event: [ push, pull_request, tag ]
|
||||||
path:
|
path:
|
||||||
include: [ backend/** ]
|
include: [ backend/** ]
|
||||||
|
|||||||
@ -101,8 +101,10 @@ def upload_to_r2(file_path):
|
|||||||
endpoint_url=R2_ENDPOINT,
|
endpoint_url=R2_ENDPOINT,
|
||||||
aws_access_key_id=R2_ACCESS_KEY,
|
aws_access_key_id=R2_ACCESS_KEY,
|
||||||
aws_secret_access_key=R2_SECRET_KEY,
|
aws_secret_access_key=R2_SECRET_KEY,
|
||||||
config=Config(signature_version='s3v4'),
|
config=Config(
|
||||||
region_name='auto'
|
signature_version='s3v4',
|
||||||
|
s3={'addressing_style': 'path'}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Upload file
|
# Upload file
|
||||||
@ -134,8 +136,10 @@ def list_r2_backups():
|
|||||||
endpoint_url=R2_ENDPOINT,
|
endpoint_url=R2_ENDPOINT,
|
||||||
aws_access_key_id=R2_ACCESS_KEY,
|
aws_access_key_id=R2_ACCESS_KEY,
|
||||||
aws_secret_access_key=R2_SECRET_KEY,
|
aws_secret_access_key=R2_SECRET_KEY,
|
||||||
config=Config(signature_version='s3v4'),
|
config=Config(
|
||||||
region_name='auto'
|
signature_version='s3v4',
|
||||||
|
s3={'addressing_style': 'path'}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import shutil
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List
|
from typing import List
|
||||||
import boto3
|
import boto3
|
||||||
|
from botocore.config import Config
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
@ -49,7 +50,10 @@ def get_r2_client():
|
|||||||
endpoint_url=os.getenv('R2_ENDPOINT'),
|
endpoint_url=os.getenv('R2_ENDPOINT'),
|
||||||
aws_access_key_id=os.getenv('R2_ACCESS_KEY'),
|
aws_access_key_id=os.getenv('R2_ACCESS_KEY'),
|
||||||
aws_secret_access_key=os.getenv('R2_SECRET_KEY'),
|
aws_secret_access_key=os.getenv('R2_SECRET_KEY'),
|
||||||
region_name='auto'
|
config=Config(
|
||||||
|
signature_version='s3v4',
|
||||||
|
s3={'addressing_style': 'path'}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -81,9 +81,9 @@ def update_recipe_db(recipe_id: int, recipe_data: Dict[str, Any]) -> Optional[Di
|
|||||||
SET name = %s,
|
SET name = %s,
|
||||||
meal_type = %s,
|
meal_type = %s,
|
||||||
time_minutes = %s,
|
time_minutes = %s,
|
||||||
tags = %s,
|
tags = %s::text[],
|
||||||
ingredients = %s,
|
ingredients = %s::text[],
|
||||||
steps = %s,
|
steps = %s::text[],
|
||||||
image = %s,
|
image = %s,
|
||||||
made_by = %s
|
made_by = %s
|
||||||
WHERE id = %s
|
WHERE id = %s
|
||||||
@ -93,9 +93,9 @@ def update_recipe_db(recipe_id: int, recipe_data: Dict[str, Any]) -> Optional[Di
|
|||||||
recipe_data["name"],
|
recipe_data["name"],
|
||||||
recipe_data["meal_type"],
|
recipe_data["meal_type"],
|
||||||
recipe_data["time_minutes"],
|
recipe_data["time_minutes"],
|
||||||
json.dumps(recipe_data.get("tags", [])),
|
recipe_data.get("tags", []),
|
||||||
json.dumps(recipe_data.get("ingredients", [])),
|
recipe_data.get("ingredients", []),
|
||||||
json.dumps(recipe_data.get("steps", [])),
|
recipe_data.get("steps", []),
|
||||||
recipe_data.get("image"),
|
recipe_data.get("image"),
|
||||||
recipe_data.get("made_by"),
|
recipe_data.get("made_by"),
|
||||||
recipe_id,
|
recipe_id,
|
||||||
@ -136,16 +136,16 @@ def create_recipe_db(recipe_data: Dict[str, Any]) -> Dict[str, Any]:
|
|||||||
cur.execute(
|
cur.execute(
|
||||||
"""
|
"""
|
||||||
INSERT INTO recipes (name, meal_type, time_minutes, tags, ingredients, steps, image, made_by, user_id)
|
INSERT INTO recipes (name, meal_type, time_minutes, tags, ingredients, steps, image, made_by, user_id)
|
||||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)
|
VALUES (%s, %s, %s, %s::text[], %s::text[], %s::text[], %s, %s, %s)
|
||||||
RETURNING id, name, meal_type, time_minutes, tags, ingredients, steps, image, made_by, user_id
|
RETURNING id, name, meal_type, time_minutes, tags, ingredients, steps, image, made_by, user_id
|
||||||
""",
|
""",
|
||||||
(
|
(
|
||||||
recipe_data["name"],
|
recipe_data["name"],
|
||||||
recipe_data["meal_type"],
|
recipe_data["meal_type"],
|
||||||
recipe_data["time_minutes"],
|
recipe_data["time_minutes"],
|
||||||
json.dumps(recipe_data.get("tags", [])),
|
recipe_data.get("tags", []),
|
||||||
json.dumps(recipe_data.get("ingredients", [])),
|
recipe_data.get("ingredients", []),
|
||||||
json.dumps(recipe_data.get("steps", [])),
|
recipe_data.get("steps", []),
|
||||||
recipe_data.get("image"),
|
recipe_data.get("image"),
|
||||||
recipe_data.get("made_by"),
|
recipe_data.get("made_by"),
|
||||||
recipe_data.get("user_id"),
|
recipe_data.get("user_id"),
|
||||||
@ -189,3 +189,4 @@ def get_recipes_by_filters_db(
|
|||||||
return rows
|
return rows
|
||||||
finally:
|
finally:
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
@ -38,8 +38,10 @@ def list_r2_backups():
|
|||||||
endpoint_url=R2_ENDPOINT,
|
endpoint_url=R2_ENDPOINT,
|
||||||
aws_access_key_id=R2_ACCESS_KEY,
|
aws_access_key_id=R2_ACCESS_KEY,
|
||||||
aws_secret_access_key=R2_SECRET_KEY,
|
aws_secret_access_key=R2_SECRET_KEY,
|
||||||
config=Config(signature_version='s3v4'),
|
config=Config(
|
||||||
region_name='auto'
|
signature_version='s3v4',
|
||||||
|
s3={'addressing_style': 'path'}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -67,8 +69,10 @@ def download_from_r2(backup_name):
|
|||||||
endpoint_url=R2_ENDPOINT,
|
endpoint_url=R2_ENDPOINT,
|
||||||
aws_access_key_id=R2_ACCESS_KEY,
|
aws_access_key_id=R2_ACCESS_KEY,
|
||||||
aws_secret_access_key=R2_SECRET_KEY,
|
aws_secret_access_key=R2_SECRET_KEY,
|
||||||
config=Config(signature_version='s3v4'),
|
config=Config(
|
||||||
region_name='auto'
|
signature_version='s3v4',
|
||||||
|
s3={'addressing_style': 'path'}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user