(file_code: FileCodes)
| 219 | |
| 220 | |
| 221 | def build_file_metadata(file_code: FileCodes) -> dict: |
| 222 | is_text = file_code.text is not None |
| 223 | remaining_downloads = ( |
| 224 | file_code.expired_count if file_code.expired_count > 0 else None |
| 225 | ) |
| 226 | return { |
| 227 | "code": file_code.code, |
| 228 | "name": file_code.prefix + file_code.suffix, |
| 229 | "size": file_code.size, |
| 230 | "type": "text" if is_text else "file", |
| 231 | "is_text": is_text, |
| 232 | "created_at": file_code.created_at, |
| 233 | "expired_at": file_code.expired_at, |
| 234 | "expires_at": file_code.expired_at, |
| 235 | "expired_count": file_code.expired_count, |
| 236 | "used_count": file_code.used_count, |
| 237 | "remaining_downloads": remaining_downloads, |
| 238 | } |
| 239 | |
| 240 | |
| 241 | async def build_select_detail( |
no outgoing calls
no test coverage detected