预签名上传会话模型
| 66 | |
| 67 | |
| 68 | class PresignUploadSession(models.Model): |
| 69 | """预签名上传会话模型""" |
| 70 | |
| 71 | id = fields.IntField(pk=True) |
| 72 | upload_id = fields.CharField(max_length=36, unique=True, index=True) |
| 73 | file_name = fields.CharField(max_length=255) |
| 74 | file_size = fields.BigIntField() |
| 75 | save_path = fields.CharField(max_length=512) |
| 76 | mode = fields.CharField(max_length=10) # "direct" 或 "proxy" |
| 77 | expire_value = fields.IntField(default=1) |
| 78 | expire_style = fields.CharField(max_length=20, default="day") |
| 79 | created_at = fields.DatetimeField(auto_now_add=True) |
| 80 | expires_at = fields.DatetimeField() # 会话过期时间 |
| 81 | |
| 82 | async def is_expired(self): |
| 83 | """检查会话是否已过期""" |
| 84 | return self.expires_at < await get_now() |
| 85 | |
| 86 | |
| 87 | file_codes_pydantic = pydantic_model_creator(FileCodes, name="FileCodes") |
nothing calls this directly
no outgoing calls
no test coverage detected