Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/WiiLink24/room-server
Browse files Browse the repository at this point in the history
  • Loading branch information
oscie57 committed Jul 5, 2024
2 parents c93f1d6 + 6d3565d commit 7470b07
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
39 changes: 39 additions & 0 deletions asset_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,45 @@ def upload_to_s3(self, im: bytes):
ExtraArgs={"ContentType": "text/xml"},
)

s3.upload_fileobj(
io.BytesIO(list_category_n("02")),
config.r2_bucket_name,
"list/category/02.xml",
ExtraArgs={"ContentType": "text/xml"},
)

s3.upload_fileobj(
io.BytesIO(list_category_n("03")),
config.r2_bucket_name,
"list/category/03.xml",
ExtraArgs={"ContentType": "text/xml"},
)

def remove_from_s3(self):
s3.delete_object(Bucket=config.r2_bucket_name, Key=self.s3_path())

# Regenerate the categories
s3.upload_fileobj(
io.BytesIO(list_category_n("01")),
config.r2_bucket_name,
"list/category/01.xml",
ExtraArgs={"ContentType": "text/xml"},
)

s3.upload_fileobj(
io.BytesIO(list_category_n("02")),
config.r2_bucket_name,
"list/category/02.xml",
ExtraArgs={"ContentType": "text/xml"},
)

s3.upload_fileobj(
io.BytesIO(list_category_n("03")),
config.r2_bucket_name,
"list/category/03.xml",
ExtraArgs={"ContentType": "text/xml"},
)


class PayCategoryAsset(Asset):
"""Used for categories within the Theater."""
Expand Down
2 changes: 1 addition & 1 deletion theunderground/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def remove_category(category):
def drop_category():
db.session.delete(current_category)
db.session.commit()
os.unlink(NormalCategoryAsset(category).asset_path())
NormalCategoryAsset(category).delete()

return redirect(url_for("list_categories"))

Expand Down

0 comments on commit 7470b07

Please sign in to comment.