MCPcopy Index your code
hub / github.com/vastsa/FileCodeBox / create_file_record

Method create_file_record

apps/base/views.py:57–83  ·  view source on GitHub ↗

统一创建FileCodes记录,返回code

(
        file_name: str,
        file_size: int,
        file_path: str,
        expire_value: int,
        expire_style: str,
        **extra_fields,
    )

Source from the content-addressed store, hash-verified

55
56 @staticmethod
57 async def create_file_record(
58 file_name: str,
59 file_size: int,
60 file_path: str,
61 expire_value: int,
62 expire_style: str,
63 **extra_fields,
64 ) -> str:
65 """统一创建FileCodes记录,返回code"""
66 expired_at, expired_count, used_count, code = await get_expire_info(
67 expire_value, expire_style
68 )
69 prefix, suffix = os.path.splitext(file_name)
70
71 await FileCodes.create(
72 code=code,
73 prefix=prefix,
74 suffix=suffix,
75 uuid_file_name=file_name,
76 file_path=file_path,
77 size=file_size,
78 expired_at=expired_at,
79 expired_count=expired_count,
80 used_count=used_count,
81 **extra_fields,
82 )
83 return code
84
85
86async def validate_file_size(file: UploadFile, max_size: int) -> int:

Callers 2

presign_upload_proxyFunction · 0.80
presign_upload_confirmFunction · 0.80

Calls 1

get_expire_infoFunction · 0.90

Tested by

no test coverage detected