✨ New Resources - File and FileBatch#226
Conversation
Codecov Report
@@ Coverage Diff @@
## main #226 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 35 37 +2
Lines 873 927 +54
=========================================
+ Hits 873 927 +54
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
alexviquez
left a comment
There was a problem hiding this comment.
ahí va, hay que ajustarlo
cuenca/resources/files.py
Outdated
|
|
||
|
|
||
| @dataclass | ||
| class File(Creatable, Downloadable, Queryable): |
cuenca/resources/files.py
Outdated
| @classmethod | ||
| def create( | ||
| cls, | ||
| file: BytesIO, | ||
| *, | ||
| session: Session = global_session, | ||
| ) -> 'File': | ||
| """ | ||
| Stores an encrypted version of the file, | ||
| only users with permissions can access it. | ||
|
|
||
| :param session: | ||
| :return: New encrypted file object | ||
| """ | ||
| req = FileRequest(file=file.read()) | ||
| response = session.post( |
There was a problem hiding this comment.
hay que usar uploadable para acá
cuenca/resources/files.py
Outdated
| @property | ||
| def pdf(self) -> bytes: | ||
| """ | ||
| Override property value for `Donwlodable` | ||
| """ | ||
| return self.file |
There was a problem hiding this comment.
pon mejor un raise de NotImplementedError
alexviquez
left a comment
There was a problem hiding this comment.
Unos comments respecto al user_id, no es necesario que lo pases en el body del request, vive en toda la sesión gracias a los blueprints, revisa como funcionan acá:
https://github.com/cuenca-mx/agave
cuenca/resources/base.py
Outdated
| resp = session.request( | ||
| 'post', | ||
| cls._resource, | ||
| data=dict(user_id=user_id), |
There was a problem hiding this comment.
No necesitas majera el user_id en el cuerpo del post request, el user_id lo tienes en toda la sesión
alexviquez
left a comment
There was a problem hiding this comment.
Unos cambios, el meme del perrito esta genial jaja
tests/resources/test_file_batches.py
Outdated
| url='https://media.getmati.com/file?location=XXX1', | ||
| type=KYCFileType.ine, | ||
| is_back=True, | ||
| ), | ||
| dict( | ||
| url='https://media.getmati.com/file?location=XXX2', | ||
| type=KYCFileType.proof_of_liveness, | ||
| ), | ||
| dict( | ||
| url='https://media.getmati.com/file?location=XXX3', | ||
| type=KYCFileType.proof_of_address, |
There was a problem hiding this comment.
cambia el path, debe ser no genérico
requirements-dev.txt
Outdated
| @@ -0,0 +1 @@ | |||
| python-magic-bin==0.4.14 | |||
cuenca/version.py
Outdated
| @@ -1,3 +1,3 @@ | |||
| __version__ = '0.7.14' | |||
| __version__ = '0.7.16.dev1' | |||
Makefile
Outdated
| install-dev: install-test | ||
| pip install -qU -r requirements-dev.txt |
| python_requires='>=3.6', | ||
| install_requires=[ | ||
| 'requests>=2.24,<28', | ||
| 'cuenca-validations>=0.9.18,<0.9.19', |
First approach of
Fileresource.The goal is to use the resource like this:
First approach of
FileBatchresource.The goal is to send
patzcuaromultiple links with theirKYCFileType.patzcuarowill download, encrypt and save the files, and return the s3 URLs where the files are being saved.