Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F71059391
README.md
Fauwaz (Fauwaz)
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
Fauwaz
Dec 13 2025, 11:12 PM
2025-12-13 23:12:39 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
README.md
View Options
#
Server
Architecture
##
๐
Project
Structure
```
server
/
โโโ
models
/
โ
โโโ
Case
.
ts
#
Type
definitions
and
interfaces
โโโ
services
/
โ
โโโ
wikidataService
.
ts
#
Wikidata
API
integration
โ
โโโ
caseFilterService
.
ts
#
Case
filtering
logic
โโโ
controllers
/
โ
โโโ
caseController
.
ts
#
Request
handlers
โโโ
server
.
ts
#
Express
app
setup
and
routes
โโโ
package
.
json
โโโ
tsconfig
.
json
```
##
๐
Module
Descriptions
###
Models
(
`
models
/
Case
.
ts
`
)
-
**
Case
**:
Interface
defining
the
structure
of
a
Supreme
Court
case
-
**
CaseFilters
**:
Interface
for
filter
criteria
-
**
FilterResponse
**:
Response
structure
for
filter
endpoint
-
**
SearchResponse
**:
Response
structure
for
search
endpoint
###
Services
####
`
services
/
wikidataService
.
ts
`
-
**
WikidataService
**:
Handles
all
interactions
with
Wikidata
API
-
`
fetchCases
()
`
:
Fetches
cases
from
Wikidata
-
`
buildSparqlQuery
()
`
:
Constructs
SPARQL
query
-
`
parseWikidataResponse
()
`
:
Parses
API
response
into
Case
objects
####
`
services
/
caseFilterService
.
ts
`
-
**
CaseFilterService
**:
Handles
case
filtering
logic
-
`
filterCases
()
`
:
Main
filtering
function
-
`
matchesKeyword
()
`
:
Keyword
matching
logic
-
`
matchesYear
()
`
:
Year
filtering
logic
-
`
matchesJudge
()
`
:
Judge
filtering
logic
-
`
matchesCaseType
()
`
:
Case
type
filtering
logic
-
`
validateYear
()
`
:
Year
validation
###
Controllers
(
`
controllers
/
caseController
.
ts
`
)
-
**
CaseController
**:
Handles
HTTP
requests
-
`
search
()
`
:
Handles
`
/
search
`
endpoint
-
`
filter
()
`
:
Handles
`
/
filter
`
endpoint
###
Main
Server
(
`
server
.
ts
`
)
-
Express
app
configuration
-
Route
definitions
-
Middleware
setup
-
Server
initialization
##
๐
API
Endpoints
###
GET
`
/
search
?
q
={
query
}
`
Basic
keyword
search
endpoint
.
###
GET
`
/
filter
?
keyword
={
keyword
}&
year
={
year
}&
judge
={
judge
}&
type
={
type
}
`
Advanced
filtering
endpoint
with
multiple
parameters
.
##
๐
Benefits
of
This
Structure
1
.
**
Separation
of
Concerns
**:
Each
module
has
a
single
responsibility
2
.
**
Maintainability
**:
Easy
to
locate
and
modify
specific
functionality
3
.
**
Testability
**:
Services
and
controllers
can
be
tested
independently
4
.
**
Scalability
**:
Easy
to
add
new
features
without
cluttering
main
server
file
5
.
**
Readability
**:
Clear
organization
makes
code
easier
to
understand
File Metadata
Details
Attached
Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
22726742
Default Alt Text
README.md (2 KB)
Attached To
Mode
T412134: Advanced Search Filter Backend
Attached
Detach File
Event Timeline
Log In to Comment