CoolFace
Apppublic

opusdev/vector-similarity-api

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes
post.cpython-314.pyc15 linesDownload Raw Back to __pycache__
1+
2^1si�����^RIHt^RIHt^RIt^RIHt]!4]P!RR4t]!]4t]R,t	]	R,t3]4PR	R5R7!RR
4t]
R8XdY]!R4]PP!R4]!R4]!R]	P"24]!R]6P"24R#R# ]dt]!R]24RtAR#RtAii;i)�)�MongoClient)�datetimeN)�load_dotenv�	MONGO_URIz#mongodb://localhost:27017/vector_db�social_media_db�posts�post_idT)�uniquec�da�]tRt^to]RRl4t]R4t]R4t]R4tRt	Vt7R#)�Postc
��RVRVRVRVRVR\P!4/p\PV4p\	VP84#)zCreate a new postr	�name�caption�	media_url�9media_type�10created_at)r�utcnow�posts_collection�11insert_one�str�inserted_id)r	rrrr�post�results&&&&&  �6C:\Users\malay\vector-similarity\api\..\models\post.py�create_post�Post.create_postsS��
�w��D��w����*��(�/�/�+�
12��"�,�,�T�2���6�%�%�&�&�c�0�\PRV/4#)zGet a post by IDr	)r�find_one�r	s&r�get_post�
Post.get_post"s�� �(�(�)�W�)=�>�>rc�<�\\P44#)z
Get all posts)�listr�find�rr�
get_all_posts�Post.get_all_posts's���$�)�)�+�,�,rc�0�\PRV/4#)z
Delete a postr	)r�13delete_oner s&r�delete_post�Post.delete_post,s�� �*�*�I�w�+?�@�@rr&N)�image)�__name__�14__module__�__qualname__�__firstlineno__�staticmethodrr!r'r+�__static_attributes__�__classdictcell__)�
__classdict__s@rrrsU�����'��'��?��?��-��-��A��Arr�__main__zTesting MongoDB connection...�pingu#✓ MongoDB connected successfully!u✓ Database: u✓ Collection: u✗ MongoDB connection failed: )�pymongorr�os�dotenvr�getenvr�client�dbr�create_indexrr.�print�admin�commandr�	Exception�er&rr�<module>rDs�����	���
�
�I�I�k�#H�I�	�	�Y�	�������g�;�����i���5�A�A�>�z��	�15)�*�5������V�$�
�3�4�
��r�w�w�i�(�)�
� �!1�!6�!6� 7�8�9����5�
�/��s�3�4�4��5�s�8A
C	�	C&�C!�!C&