Skip to content

Commit

Permalink
Merge branch 'develop-postgres' into setup_script
Browse files Browse the repository at this point in the history
  • Loading branch information
prayanshchh authored Feb 24, 2025
2 parents 730c935 + 2438e61 commit 8b14b49
Show file tree
Hide file tree
Showing 40 changed files with 3,414 additions and 1,399 deletions.
84 changes: 62 additions & 22 deletions .github/workflows/scripts/detect_ts_ignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import re
import sys
import logging
import os

# Configure logging
logging.basicConfig(
Expand All @@ -14,6 +15,45 @@

TS_IGNORE_PATTERN = r"(?://|/\*)\s*@ts-ignore(?:\s+|$)"

IGNORED_EXTENSIONS = {
# Image formats
".avif",
".jpeg",
".jpg",
".png",
".webp",
".gif",
".bmp",
".ico",
".svg",
# Video formats
".mp4",
".webm",
".mov",
".avi",
".mkv",
# Audio formats
".mp3",
".wav",
".ogg",
# Document formats
".pdf",
".doc",
".docx",
}


def is_binary_file(filepath: str) -> bool:
"""Check if a file is binary based on its extension.
Args:
filepath (str): The file path.
Returns:
bool: True if the file should be ignored, False otherwise.
"""
return os.path.splitext(filepath)[1].lower() in IGNORED_EXTENSIONS


def check_ts_ignore(files: list[str]) -> int:
"""Check for occurrences of '@ts-ignore' in the given files.
Expand All @@ -27,29 +67,29 @@ def check_ts_ignore(files: list[str]) -> int:
ts_ignore_found = False

for file in files:
try:
logging.info("Checking file: %s", file)
with open(file, encoding="utf-8") as f:
for line_num, line in enumerate(f, start=1):
# Handle more variations of @ts-ignore
if re.search(
TS_IGNORE_PATTERN,
line.strip(),
):
print(
"❌ Error: '@ts-ignore' found in %s at line %d",
file,
line_num,
)
logging.debug(
"Found @ts-ignore in line: %s",
if not is_binary_file(file):
try:
logging.info("Checking file: %s", file)
with open(file, encoding="utf-8") as f:
for line_num, line in enumerate(f, start=1):
# Handle more variations of @ts-ignore
if re.search(
TS_IGNORE_PATTERN,
line.strip(),
)
ts_ignore_found = True
except FileNotFoundError:
logging.warning("File not found: %s", file)
except OSError:
logging.exception("Could not read %s", file)
):
print(
f"❌ Error: '@ts-ignore' found in {file} ",
f"at line {line_num}",
)
logging.debug(
"Found @ts-ignore in line: %s",
line.strip(),
)
ts_ignore_found = True
except FileNotFoundError:
logging.warning("File not found: %s", file)
except OSError:
logging.exception("Could not read %s", file)
if not ts_ignore_found:
print("✅ No '@ts-ignore' comments found in the files.")

Expand Down
10 changes: 10 additions & 0 deletions docs/docs/docs/developer-resources/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ sidebar_position: 1

Welcome to the Talawa-API developer resources.

## Design Philosophy

Coming Soon

### Authentication

We have kept the authentication system very minimal so that a proper authentication system can be put in place later on. We feel that some kind of typescript based authentication library that can integrate with the current database schema or a self hosted service with its own database is needed.

For this reason, the authentication system needs to be detached from the GraphQL schema and be handled using REST APIs using something like Better Auth: https://github.com/better-auth/better-auth

## Important Directories

Review these important locations before you start your coding journey.
Expand Down
Loading

0 comments on commit 8b14b49

Please sign in to comment.