🔧 chore: 同步完整后端运行模块

This commit is contained in:
orion committed 2026-09-11 17:13:03 +08:00
1 parent d104b9fc8b
commit 2d44699eec
20 files changed
+1465 -235

No files matched your search

+22
View File
@@ -46,6 +46,19 @@ class FileCodes(models.Model):
return f"{self.file_path}/{self.uuid_file_name}"
class ShareCodeReservations(models.Model):
"""已退役取件码的永久封存登记,防止恢复文件后旧码被重新分配。"""
id = fields.IntField(pk=True)
code = fields.CharField(max_length=255, unique=True, index=True)
file_code_id = fields.IntField(null=True, index=True)
reason = fields.CharField(max_length=32, default="retired")
created_at = fields.DatetimeField(auto_now_add=True)
class Meta:
table = "share_code_reservations"
class UploadChunk(models.Model):
id = fields.IntField(pk=True)
upload_id = fields.CharField(max_length=36, index=True)
@@ -108,6 +121,15 @@ class PresignUploadSession(models.Model):
return self.expires_at < await get_now()
class StorageReservation(models.Model):
"""尚未写入 FileCodes 的上传容量预留。"""
id = fields.IntField(pk=True)
token = fields.CharField(max_length=64, unique=True, index=True)
size = fields.BigIntField()
expires_at = fields.DatetimeField(index=True)
file_codes_pydantic = pydantic_model_creator(FileCodes, name="FileCodes")
upload_chunk_pydantic = pydantic_model_creator(UploadChunk, name="UploadChunk")
key_value_pydantic = pydantic_model_creator(KeyValue, name="KeyValue")