Skip to content
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
04bfb79
do not scale/zoom card on hover
rudransh-shrivastava Aug 8, 2026
c378e38
introduce fat methods approving claims
rudransh-shrivastava Aug 8, 2026
82e6975
simplify code by making BoardcandidateClaim.board a mandatory field
rudransh-shrivastava Aug 8, 2026
05463a5
rename BoardOfDirectors.reviewers to claim_reviewers
rudransh-shrivastava Aug 8, 2026
dc12dde
update bod.dump
rudransh-shrivastava Aug 8, 2026
8ff5fc8
address exif metadata stripping related review comments
rudransh-shrivastava Aug 8, 2026
be4f8c6
do not shink candidate card on click
rudransh-shrivastava Aug 8, 2026
f7c7208
add pydantic input validation for graphql mutations
rudransh-shrivastava Aug 9, 2026
65f409a
Merge branch 'feature/bod-candidate-transparency' into feature/bod-ca…
rudransh-shrivastava Aug 9, 2026
01b8d21
generate graphql types post merge
rudransh-shrivastava Aug 9, 2026
cefd1e6
fix source_url bug
rudransh-shrivastava Aug 9, 2026
c658f48
address bot comments
rudransh-shrivastava Aug 9, 2026
099fae5
run prettier
rudransh-shrivastava Aug 9, 2026
5bfb5be
fix frontend tests
rudransh-shrivastava Aug 9, 2026
189c0c1
add s3 bucket for django media storage for production and staging
rudransh-shrivastava Aug 9, 2026
9f54b73
set custom_domain in storage options
rudransh-shrivastava Aug 9, 2026
d3c1385
apply bot comments
rudransh-shrivastava Aug 15, 2026
e99b6bf
update code
rudransh-shrivastava Aug 15, 2026
fcc41cd
publicly show Submitted claims
rudransh-shrivastava Aug 16, 2026
c36300c
update code
rudransh-shrivastava Aug 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified backend/data/bod.dump
Binary file not shown.
Empty file.
Empty file.
Empty file.
76 changes: 76 additions & 0 deletions backend/src/apps/common/api/internal/mutations/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"""Shared GraphQL mutation building blocks."""

import functools
import inspect
from collections.abc import Callable
from typing import Any

import pydantic
import strawberry
from strawberry.utils.str_converters import to_camel_case


@strawberry.type
class FieldError:
"""Per-field validation error."""

field: str
message: str


def pydantic_errors_to_field_errors(exc: pydantic.ValidationError) -> list[FieldError]:
"""Convert a Pydantic ValidationError into a list of FieldError.

Args:
exc (pydantic.ValidationError): Error raised by to_pydantic().

Returns:
list[FieldError]: One entry per validation issue.

"""
return [
FieldError(
field=".".join(to_camel_case(str(part)) for part in err["loc"]),
message=err["msg"],
)
for err in exc.errors()
]


def validate_pydantic_input(
result_cls: type[Any],
input_arg: str = "input_data",
) -> Callable:
"""Wrap a mutation resolver with Pydantic input validation.

Args:
result_cls (type): The Result GraphQL type used to return validation errors.
input_arg (str, optional): Name of the resolver's input argument to validate.
Defaults to "input_data".

Returns:
Callable: A decorator that validates the resolver's input.

"""

def decorator(func: Callable) -> Callable:
signature = inspect.signature(func)

@functools.wraps(func)
def wrapper(*args, **kwargs):
bound = signature.bind(*args, **kwargs)
input_data = bound.arguments[input_arg]
try:
object.__setattr__(input_data, "validated_data", input_data.to_pydantic())
except pydantic.ValidationError as e:
return result_cls(
ok=False,
code="VALIDATION_ERROR",
message="Some fields are invalid.",
field_errors=pydantic_errors_to_field_errors(e),
)
return func(*args, **kwargs)

return wrapper

return decorator
2 changes: 1 addition & 1 deletion backend/src/apps/owasp/admin/board_of_directors.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class BoardOfDirectorsAdmin(admin.ModelAdmin):
"""Admin for Snapshot model."""

filter_horizontal = ("reviewers",)
filter_horizontal = ("claim_reviewers",)
list_filter = ("year",)
ordering = ("-year",)
search_fields = ("year",)
Expand Down
Loading
Loading