Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Shankar-105/Social-Media-Api
/ functions
Functions
373 in github.com/Shankar-105/Social-Media-Api
⨍
Functions
373
◇
Types & classes
106
↳
Endpoints
72
↓ 24 callers
Method
send_personal_message
(self, message: dict, user_id: int)
app/utils/socket_manager.py:153
↓ 19 callers
Function
db_session_factory
()
pytests/conftest.py:292
↓ 18 callers
Function
delete_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 callers
Function
delete_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 callers
Method
disconnect
(self, user_id: int, client_initiated: bool = True, last_seen_at: datetime | None = None)
app/utils/socket_manager.py:27
↓ 15 callers
Function
increment_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 callers
Function
_drop_constraint
(table: str, name: str)
alembic/versions/d8a5f4b7c2e1_harden_schema_indexes.py:56
↓ 14 callers
Function
_safe_int
(value)
app/messaging/chat.py:63
↓ 14 callers
Function
get_blob_url
(container: str, blob_name: str)
app/services/blob_service.py:40
↓ 13 callers
Function
_add_check
(table: str, name: str, expression: str)
alembic/versions/d8a5f4b7c2e1_harden_schema_indexes.py:20
↓ 13 callers
Function
format_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 callers
Method
send_json_to_user
(self, message: dict, user_id: int)
app/utils/socket_manager.py:162
↓ 11 callers
Function
get_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 callers
Function
set_cache
Store something in Redis. Parameters ---------- key : str A unique name for this cached item. Convention: "resource_
app/services/redis_service.py:59
↓ 10 callers
Function
makeAuthHeaders
(token)
loadtests/common.js:12
↓ 9 callers
Method
__init__
( self, message: str, status_code: int = status.HTTP_500_INTERNAL_SERVER_ERROR,
app/utils/exceptions.py:8
↓ 7 callers
Method
delay
(self, *args, **kwargs)
pytests/conftest.py:61
↓ 6 callers
Function
run_with_transient_retry
( operation: Callable[[], Awaitable[T]], *, db: AsyncSession | None = None, attempts: int = 3,
app/services/concurrency_service.py:35
↓ 5 callers
Method
connect
(self, user_id: int, websocket: WebSocket)
app/utils/socket_manager.py:19
↓ 5 callers
Function
delete_blob
Delete a blob silently (no-op if missing).
app/services/blob_service.py:69
↓ 5 callers
Function
ip_rate_limit
(endpoint_id: str, max_calls: int, window: int)
app/services/rate_limit_service.py:68
↓ 5 callers
Function
lock_user_row
( db: AsyncSession, *, user_id: int | None = None, email: str | None = None, )
app/services/concurrency_service.py:69
↓ 5 callers
Function
user_rate_limit
(endpoint_id: str, max_calls: int, window: int)
app/services/rate_limit_service.py:77
↓ 4 callers
Function
setup_logging
Configures structlog for the entire application. Supports development (pretty console) and production (structured JSON).
app/utils/logging.py:34
↓ 3 callers
Function
_container_to_local_path
(container: str)
app/services/blob_service.py:17
↓ 3 callers
Function
_hash_otp
(raw_otp: str)
app/services/otp_service.py:15
↓ 3 callers
Function
_seed_chat_users
(session_factory)
pytests/test_concurrency_hardening.py:18
↓ 3 callers
Method
broadcast_presence_update
( self, db: AsyncSession, user_id: int, online: bool, last_seen_at: da
app/utils/socket_manager.py:89
↓ 3 callers
Method
is_online
(self, user_id: int)
app/utils/socket_manager.py:37
↓ 3 callers
Function
runMixedScenario
(data)
loadtests/common.js:217
↓ 3 callers
Function
setupContext
()
loadtests/common.js:62
↓ 3 callers
Function
upload_blob
Upload bytes to blob storage and return the public URL.
app/services/blob_service.py:49
↓ 2 callers
Function
_check
(key: str, max_calls: int, window: int)
app/services/rate_limit_service.py:52
↓ 2 callers
Function
_delete_once
()
pytests/test_concurrency_hardening.py:139
↓ 2 callers
Function
_follow_once
()
pytests/test_concurrency_hardening.py:178
↓ 2 callers
Function
_get_client
()
app/services/blob_service.py:33
↓ 2 callers
Function
_hash_refresh_token
(token_str: str)
app/services/token_service.py:18
↓ 2 callers
Method
_inject_peer_presence
(self, message: dict, target_user_id: int)
app/utils/socket_manager.py:131
↓ 2 callers
Function
_is_azure_enabled
()
app/services/blob_service.py:13
↓ 2 callers
Method
_iso_or_none
(self, dt: datetime | None)
app/utils/socket_manager.py:44
↓ 2 callers
Function
_load_once
()
pytests/test_concurrency_hardening.py:104
↓ 2 callers
Function
_redis_message_listener
(channel: str)
app/main.py:32
↓ 2 callers
Function
_run_once
()
pytests/test_concurrency_hardening.py:63
↓ 2 callers
Function
_sha256_hex
(value: str)
alembic/versions/f2a6c1d4b8e9_hash_auth_secrets.py:21
↓ 2 callers
Function
_validate_access_token
(token: str, credentials_exception)
app/oauth2.py:99
↓ 2 callers
Method
get_last_seen
(self, user_id: int)
app/utils/socket_manager.py:41
↓ 2 callers
Function
get_local_indian_time
Returns IST timezone (UTC +5:30)
app/utils/time_formatting.py:62
↓ 2 callers
Method
mark_last_seen
(self, db: AsyncSession, user_id: int)
app/utils/socket_manager.py:60
↓ 2 callers
Function
reconcile_denormalized_counters
Repair denormalized counters from source-of-truth tables.
app/services/reconciliation_service.py:11
↓ 2 callers
Function
tryLoginForToken
()
loadtests/common.js:38
↓ 1 callers
Function
_add_unique
(table: str, name: str, columns: str)
alembic/versions/d8a5f4b7c2e1_harden_schema_indexes.py:38
↓ 1 callers
Function
_build_otlp_span_exporter
Build an OTLP span exporter from explicit environment configuration.
app/utils/observability.py:24
↓ 1 callers
Function
_build_user_cache_payload
(user: models.User)
app/oauth2.py:77
↓ 1 callers
Function
_build_user_from_cache
(cached: dict)
app/oauth2.py:64
↓ 1 callers
Function
_chat_messages_listener
()
app/main.py:50
↓ 1 callers
Function
_cleanup
()
app/tasks/otp_cleanup_task.py:10
↓ 1 callers
Function
_consume_token_bucket
(key: str, max_calls: int, window: int)
app/services/rate_limit_service.py:12
↓ 1 callers
Function
_do_flush
()
app/tasks/post_view_flush_task.py:23
↓ 1 callers
Function
_ensure_parent_dir
(path: str)
app/services/blob_service.py:27
↓ 1 callers
Function
_get_access_token_ttl_seconds
(payload: dict)
app/oauth2.py:92
↓ 1 callers
Function
_notification_messages_listener
()
app/main.py:53
↓ 1 callers
Method
_peer_ids
(self, db: AsyncSession, user_id: int)
app/utils/socket_manager.py:73
↓ 1 callers
Function
_pg_code_from_error
(error: BaseException)
app/services/concurrency_service.py:22
↓ 1 callers
Function
_reconcile
()
app/tasks/reconciliation_task.py:10
↓ 1 callers
Function
_remove_picture
()
app/routes/me.py:59
↓ 1 callers
Function
_reset_password
()
app/routes/auth.py:130
↓ 1 callers
Function
_reset_password
()
app/routes/changepassword.py:37
↓ 1 callers
Function
_update_profile
()
app/routes/me.py:165
↓ 1 callers
Function
_verify_email
()
app/routes/auth.py:150
↓ 1 callers
Method
ack_presence_heartbeat
(self, user_id: int, heartbeat_event: asyncio.Event)
app/utils/socket_manager.py:127
↓ 1 callers
Method
active
(self)
pytests/test_celery_infrastructure.py:26
↓ 1 callers
Function
check_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 callers
Function
configure_observability
(app: FastAPI, async_engine)
app/utils/observability.py:133
↓ 1 callers
Function
create_notification
( actor_id: int, owner_id: int, notif_type: NotificationType, actor_username: str, entity_
app/services/notification_service.py:36
↓ 1 callers
Function
create_refresh_token
( db: AsyncSession, user_id: int, family_id: str | None = None )
app/services/token_service.py:22
↓ 1 callers
Function
create_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 callers
Function
decodeToken
Decode a JWT token — offloaded to a thread pool to avoid blocking the event loop.
app/oauth2.py:59
↓ 1 callers
Method
get_presence_payload
(self, user_id: int)
app/utils/socket_manager.py:51
↓ 1 callers
Function
get_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 callers
Function
hitCommentStats
(token)
loadtests/common.js:193
↓ 1 callers
Function
hitFeedExplore
(token)
loadtests/common.js:97
↓ 1 callers
Function
hitFeedHome
(token)
loadtests/common.js:157
↓ 1 callers
Function
hitHealth
()
loadtests/common.js:75
↓ 1 callers
Function
hitMePosts
(token)
loadtests/common.js:169
↓ 1 callers
Function
hitNotifications
(token)
loadtests/common.js:133
↓ 1 callers
Function
hitPostDetails
(token)
loadtests/common.js:145
↓ 1 callers
Function
hitSearch
(token)
loadtests/common.js:109
↓ 1 callers
Function
hitUserPosts
(token)
loadtests/common.js:121
↓ 1 callers
Function
hitUserProfile
(token)
loadtests/common.js:181
↓ 1 callers
Function
hitUsersAll
()
loadtests/common.js:86
↓ 1 callers
Function
hitVoteStats
(token)
loadtests/common.js:205
↓ 1 callers
Function
is_transient_db_error
(error: BaseException)
app/services/concurrency_service.py:31
↓ 1 callers
Function
operation
()
pytests/test_concurrency_hardening.py:366
↓ 1 callers
Function
ping_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 callers
Function
queue_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 callers
Function
register_exception_handlers
(app: FastAPI)
app/utils/exception_handlers.py:11
↓ 1 callers
Method
reserved
(self)
pytests/test_celery_infrastructure.py:29
↓ 1 callers
Function
revoke_family
Mark ALL tokens in this family as revoked (reuse detection response).
app/services/token_service.py:110
↓ 1 callers
Function
run_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 callers
Function
run_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