MCPcopy Create free account

hub / github.com/Shankar-105/Social-Media-Api / functions

Functions373 in github.com/Shankar-105/Social-Media-Api

↓ 24 callersMethodsend_personal_message
(self, message: dict, user_id: int)
app/utils/socket_manager.py:153
↓ 19 callersFunctiondb_session_factory
()
pytests/conftest.py:292
↓ 18 callersFunctiondelete_cache_pattern
Remove ALL keys matching a pattern. Example: delete_cache_pattern("user_profile:*") This would delete user_profile:1, user_profile:2, et
app/services/redis_service.py:117
↓ 17 callersFunctiondelete_cache
Remove a specific key from Redis (invalidate the cache). Call this when the underlying data changes, e.g. after a user updates their prof
app/services/redis_service.py:106
↓ 15 callersMethoddisconnect
(self, user_id: int, client_initiated: bool = True, last_seen_at: datetime | None = None)
app/utils/socket_manager.py:27
↓ 15 callersFunctionincrement_cache_version
Increment the cache version for a domain (e.g., 'feed:home', 'feed:explore'). Returns the new version number. This enables fast invalidat
app/services/redis_service.py:201
↓ 14 callersFunction_drop_constraint
(table: str, name: str)
alembic/versions/d8a5f4b7c2e1_harden_schema_indexes.py:56
↓ 14 callersFunction_safe_int
(value)
app/messaging/chat.py:63
↓ 14 callersFunctionget_blob_url
(container: str, blob_name: str)
app/services/blob_service.py:40
↓ 13 callersFunction_add_check
(table: str, name: str, expression: str)
alembic/versions/d8a5f4b7c2e1_harden_schema_indexes.py:20
↓ 13 callersFunctionformat_timestamp
Converts a datetime (with or without timezone) into human-readable format Examples: Just now → if < 1 min ago 5m ago → if <
app/utils/time_formatting.py:4
↓ 13 callersMethodsend_json_to_user
(self, message: dict, user_id: int)
app/utils/socket_manager.py:162
↓ 11 callersFunctionget_cache
Retrieve something from Redis. Returns ------- The original Python object (dict/list/etc.) if the key exists, or None if the key
app/services/redis_service.py:88
↓ 11 callersFunctionset_cache
Store something in Redis. Parameters ---------- key : str A unique name for this cached item. Convention: "resource_
app/services/redis_service.py:59
↓ 10 callersFunctionmakeAuthHeaders
(token)
loadtests/common.js:12
↓ 9 callersMethod__init__
( self, message: str, status_code: int = status.HTTP_500_INTERNAL_SERVER_ERROR,
app/utils/exceptions.py:8
↓ 7 callersMethoddelay
(self, *args, **kwargs)
pytests/conftest.py:61
↓ 6 callersFunctionrun_with_transient_retry
( operation: Callable[[], Awaitable[T]], *, db: AsyncSession | None = None, attempts: int = 3,
app/services/concurrency_service.py:35
↓ 5 callersMethodconnect
(self, user_id: int, websocket: WebSocket)
app/utils/socket_manager.py:19
↓ 5 callersFunctiondelete_blob
Delete a blob silently (no-op if missing).
app/services/blob_service.py:69
↓ 5 callersFunctionip_rate_limit
(endpoint_id: str, max_calls: int, window: int)
app/services/rate_limit_service.py:68
↓ 5 callersFunctionlock_user_row
( db: AsyncSession, *, user_id: int | None = None, email: str | None = None, )
app/services/concurrency_service.py:69
↓ 5 callersFunctionuser_rate_limit
(endpoint_id: str, max_calls: int, window: int)
app/services/rate_limit_service.py:77
↓ 4 callersFunctionsetup_logging
Configures structlog for the entire application. Supports development (pretty console) and production (structured JSON).
app/utils/logging.py:34
↓ 3 callersFunction_container_to_local_path
(container: str)
app/services/blob_service.py:17
↓ 3 callersFunction_hash_otp
(raw_otp: str)
app/services/otp_service.py:15
↓ 3 callersFunction_seed_chat_users
(session_factory)
pytests/test_concurrency_hardening.py:18
↓ 3 callersMethodbroadcast_presence_update
( self, db: AsyncSession, user_id: int, online: bool, last_seen_at: da
app/utils/socket_manager.py:89
↓ 3 callersMethodis_online
(self, user_id: int)
app/utils/socket_manager.py:37
↓ 3 callersFunctionrunMixedScenario
(data)
loadtests/common.js:217
↓ 3 callersFunctionsetupContext
()
loadtests/common.js:62
↓ 3 callersFunctionupload_blob
Upload bytes to blob storage and return the public URL.
app/services/blob_service.py:49
↓ 2 callersFunction_check
(key: str, max_calls: int, window: int)
app/services/rate_limit_service.py:52
↓ 2 callersFunction_delete_once
()
pytests/test_concurrency_hardening.py:139
↓ 2 callersFunction_follow_once
()
pytests/test_concurrency_hardening.py:178
↓ 2 callersFunction_get_client
()
app/services/blob_service.py:33
↓ 2 callersFunction_hash_refresh_token
(token_str: str)
app/services/token_service.py:18
↓ 2 callersMethod_inject_peer_presence
(self, message: dict, target_user_id: int)
app/utils/socket_manager.py:131
↓ 2 callersFunction_is_azure_enabled
()
app/services/blob_service.py:13
↓ 2 callersMethod_iso_or_none
(self, dt: datetime | None)
app/utils/socket_manager.py:44
↓ 2 callersFunction_load_once
()
pytests/test_concurrency_hardening.py:104
↓ 2 callersFunction_redis_message_listener
(channel: str)
app/main.py:32
↓ 2 callersFunction_run_once
()
pytests/test_concurrency_hardening.py:63
↓ 2 callersFunction_sha256_hex
(value: str)
alembic/versions/f2a6c1d4b8e9_hash_auth_secrets.py:21
↓ 2 callersFunction_validate_access_token
(token: str, credentials_exception)
app/oauth2.py:99
↓ 2 callersMethodget_last_seen
(self, user_id: int)
app/utils/socket_manager.py:41
↓ 2 callersFunctionget_local_indian_time
Returns IST timezone (UTC +5:30)
app/utils/time_formatting.py:62
↓ 2 callersMethodmark_last_seen
(self, db: AsyncSession, user_id: int)
app/utils/socket_manager.py:60
↓ 2 callersFunctionreconcile_denormalized_counters
Repair denormalized counters from source-of-truth tables.
app/services/reconciliation_service.py:11
↓ 2 callersFunctiontryLoginForToken
()
loadtests/common.js:38
↓ 1 callersFunction_add_unique
(table: str, name: str, columns: str)
alembic/versions/d8a5f4b7c2e1_harden_schema_indexes.py:38
↓ 1 callersFunction_build_otlp_span_exporter
Build an OTLP span exporter from explicit environment configuration.
app/utils/observability.py:24
↓ 1 callersFunction_build_user_cache_payload
(user: models.User)
app/oauth2.py:77
↓ 1 callersFunction_build_user_from_cache
(cached: dict)
app/oauth2.py:64
↓ 1 callersFunction_chat_messages_listener
()
app/main.py:50
↓ 1 callersFunction_cleanup
()
app/tasks/otp_cleanup_task.py:10
↓ 1 callersFunction_consume_token_bucket
(key: str, max_calls: int, window: int)
app/services/rate_limit_service.py:12
↓ 1 callersFunction_do_flush
()
app/tasks/post_view_flush_task.py:23
↓ 1 callersFunction_ensure_parent_dir
(path: str)
app/services/blob_service.py:27
↓ 1 callersFunction_get_access_token_ttl_seconds
(payload: dict)
app/oauth2.py:92
↓ 1 callersFunction_notification_messages_listener
()
app/main.py:53
↓ 1 callersMethod_peer_ids
(self, db: AsyncSession, user_id: int)
app/utils/socket_manager.py:73
↓ 1 callersFunction_pg_code_from_error
(error: BaseException)
app/services/concurrency_service.py:22
↓ 1 callersFunction_reconcile
()
app/tasks/reconciliation_task.py:10
↓ 1 callersFunction_remove_picture
()
app/routes/me.py:59
↓ 1 callersFunction_reset_password
()
app/routes/auth.py:130
↓ 1 callersFunction_reset_password
()
app/routes/changepassword.py:37
↓ 1 callersFunction_update_profile
()
app/routes/me.py:165
↓ 1 callersFunction_verify_email
()
app/routes/auth.py:150
↓ 1 callersMethodack_presence_heartbeat
(self, user_id: int, heartbeat_event: asyncio.Event)
app/utils/socket_manager.py:127
↓ 1 callersMethodactive
(self)
pytests/test_celery_infrastructure.py:26
↓ 1 callersFunctioncheck_redis_connection
Call this once at app startup to confirm Redis is reachable. Returns True if connected, False otherwise.
app/services/redis_service.py:142
↓ 1 callersFunctionconfigure_observability
(app: FastAPI, async_engine)
app/utils/observability.py:133
↓ 1 callersFunctioncreate_notification
( actor_id: int, owner_id: int, notif_type: NotificationType, actor_username: str, entity_
app/services/notification_service.py:36
↓ 1 callersFunctioncreate_refresh_token
( db: AsyncSession, user_id: int, family_id: str | None = None )
app/services/token_service.py:22
↓ 1 callersFunctioncreate_test_database_if_not_exists
Create the test database if it doesn't exist. Connects to the default 'postgres' database to create our test database. Uses sync psycopg2
pytests/conftest.py:160
↓ 1 callersFunctiondecodeToken
Decode a JWT token — offloaded to a thread pool to avoid blocking the event loop.
app/oauth2.py:59
↓ 1 callersMethodget_presence_payload
(self, user_id: int)
app/utils/socket_manager.py:51
↓ 1 callersFunctionget_test_database_host
Automatically detect if running in Docker container and return appropriate host. Detection methods (in order): 1. Check for /.dockerenv f
pytests/conftest.py:110
↓ 1 callersFunctionhitCommentStats
(token)
loadtests/common.js:193
↓ 1 callersFunctionhitFeedExplore
(token)
loadtests/common.js:97
↓ 1 callersFunctionhitFeedHome
(token)
loadtests/common.js:157
↓ 1 callersFunctionhitHealth
()
loadtests/common.js:75
↓ 1 callersFunctionhitMePosts
(token)
loadtests/common.js:169
↓ 1 callersFunctionhitNotifications
(token)
loadtests/common.js:133
↓ 1 callersFunctionhitPostDetails
(token)
loadtests/common.js:145
↓ 1 callersFunctionhitSearch
(token)
loadtests/common.js:109
↓ 1 callersFunctionhitUserPosts
(token)
loadtests/common.js:121
↓ 1 callersFunctionhitUserProfile
(token)
loadtests/common.js:181
↓ 1 callersFunctionhitUsersAll
()
loadtests/common.js:86
↓ 1 callersFunctionhitVoteStats
(token)
loadtests/common.js:205
↓ 1 callersFunctionis_transient_db_error
(error: BaseException)
app/services/concurrency_service.py:31
↓ 1 callersFunctionoperation
()
pytests/test_concurrency_hardening.py:366
↓ 1 callersFunctionping_redis
Check if Redis is reachable. Returns True if connected, False otherwise. Under the hood this sends the PING command to the Redis ser
app/services/redis_service.py:46
↓ 1 callersFunctionqueue_post_view
Queue a post view for async processing instead of inserting synchronously. This decouples the read path from DB writes, reducing latency.
app/services/redis_service.py:243
↓ 1 callersFunctionregister_exception_handlers
(app: FastAPI)
app/utils/exception_handlers.py:11
↓ 1 callersMethodreserved
(self)
pytests/test_celery_infrastructure.py:29
↓ 1 callersFunctionrevoke_family
Mark ALL tokens in this family as revoked (reuse detection response).
app/services/token_service.py:110
↓ 1 callersFunctionrun_migrations_offline
Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as w
alembic/env.py:32
↓ 1 callersFunctionrun_migrations_online
Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
alembic/env.py:56
next →1–100 of 373, ranked by callers