Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare v4.0 release #282

Merged
merged 1,554 commits into from
Jan 3, 2025
Merged
Changes from 1 commit
Commits
Show all changes
1554 commits
Select commit Hold shift + click to select a range
ccbaaf6
Start implementing multiple language support for national calendars
JohnRDOrazio Nov 26, 2024
01ae413
Create JsonData enum, reorder diocesan calendars folder
JohnRDOrazio Nov 26, 2024
3535fb7
refactor `/calendars` metadata path
JohnRDOrazio Nov 27, 2024
730acb3
add intelephense-helper for ALLOWED_ORIGINS const
JohnRDOrazio Nov 27, 2024
4ac9f0f
remove dependency on diocesan index.json
JohnRDOrazio Nov 27, 2024
6a0e56b
implement multiple possible locales for national and diocesan calendars
JohnRDOrazio Nov 27, 2024
1253c7d
add diocesan groups to diocesan calendar metadata
JohnRDOrazio Nov 27, 2024
bb41bbc
ensure nation is always uppercase
JohnRDOrazio Nov 27, 2024
c2bb1c6
load wider region i18n data after locale has been set
JohnRDOrazio Nov 27, 2024
87ad4fa
add common for all createNew entries
JohnRDOrazio Nov 27, 2024
74b45a4
refactor from diocese index.json to `/calendars` route
JohnRDOrazio Nov 28, 2024
0e60ee9
take litevent name from i18n file only if defined
JohnRDOrazio Nov 28, 2024
79741bb
fix CA caldata and create Roman Missal definition
JohnRDOrazio Nov 28, 2024
d67d7e2
add ref to 2011 edition Roman Missal Canada
JohnRDOrazio Nov 28, 2024
1d910bd
fix apply diocesan calendar data
JohnRDOrazio Nov 28, 2024
b51f43f
refactor to use JsonData class
JohnRDOrazio Nov 28, 2024
85d52bf
remove data path and i18n folder from metadata response
JohnRDOrazio Nov 28, 2024
3d9f9b3
add subroutes to route class
JohnRDOrazio Nov 28, 2024
cae007a
wider region is multilingual, period. no need to set this as an option
JohnRDOrazio Nov 28, 2024
5895ad5
refactor with new JsonData cases for i18n files
JohnRDOrazio Nov 28, 2024
3fdff79
fix whitespaces
JohnRDOrazio Nov 28, 2024
36d21fc
fix whitespace issues
JohnRDOrazio Nov 28, 2024
785e299
Merge pull request #267 from Liturgical-Calendar/JohnRDOrazio/issue150
JohnRDOrazio Nov 28, 2024
5199111
regenerated i18n/litcal.pot from source files
github-actions[bot] Nov 28, 2024
523dcef
Update translation files
weblate Nov 28, 2024
7ea7564
remove temporary schema refs
JohnRDOrazio Nov 28, 2024
f6b8546
Merge remote-tracking branch 'origin/development' into development
weblate Nov 28, 2024
cb1868f
Merge pull request #268 from Liturgical-Calendar/weblate
JohnRDOrazio Nov 28, 2024
e9c8ee7
move `name` property to i18n file
JohnRDOrazio Nov 28, 2024
8c7c173
add Canadian Missals to Missal defs
JohnRDOrazio Nov 28, 2024
4562c10
add list of valid timezone identifiers
JohnRDOrazio Nov 28, 2024
69f397f
create DiocesanName enum
JohnRDOrazio Nov 28, 2024
ae6b8e3
add nation and diocese events paths to Route enum
JohnRDOrazio Nov 28, 2024
2065c33
account for possible locale in resourceDataCheck
JohnRDOrazio Nov 28, 2024
8c9a650
fix data path schema detection
JohnRDOrazio Nov 28, 2024
8a4b423
only retrieve names for existing i18n keys
JohnRDOrazio Nov 28, 2024
bc81b04
ensure locale is among supported locales for national calendar
JohnRDOrazio Nov 28, 2024
8727076
do not overwrite locale to baselocale, keep separate
JohnRDOrazio Nov 28, 2024
1c56573
use baselocale for missal and decrees data
JohnRDOrazio Nov 28, 2024
c3103da
conditionally load litcal event name if key exists
JohnRDOrazio Nov 29, 2024
3306c63
conditionally load missa event name if key exists
JohnRDOrazio Nov 29, 2024
1cb759b
allow full locale for events path schema
JohnRDOrazio Nov 29, 2024
853e4c2
more precise regex match for events path
JohnRDOrazio Nov 29, 2024
a01f919
fix ref to definitions/Locale
JohnRDOrazio Nov 29, 2024
70e7ead
create ref to definitions/Locale
JohnRDOrazio Nov 29, 2024
daf8aa4
allow name property on festivity schema in events
JohnRDOrazio Nov 29, 2024
847512b
remove required keys (should have better anyOf cases though)
JohnRDOrazio Nov 29, 2024
2565efa
create various National Calendar cases
JohnRDOrazio Nov 29, 2024
5c54247
remove unneeded month and day properties
JohnRDOrazio Nov 29, 2024
007428e
try anyOf in place of oneOf?
JohnRDOrazio Nov 29, 2024
de564e0
rearrange fixed / mobile defs
JohnRDOrazio Nov 29, 2024
e65b2b1
remove accented characters from event keys
JohnRDOrazio Nov 29, 2024
2b386d4
get name from i18n data
JohnRDOrazio Nov 29, 2024
5304d51
update name from i18n data if setProperty=name
JohnRDOrazio Nov 29, 2024
8decf03
decode i18n data as assoc array
JohnRDOrazio Nov 29, 2024
3853cba
check value of data->key
JohnRDOrazio Nov 29, 2024
2da35e9
debug national_calendars
JohnRDOrazio Nov 29, 2024
29533f1
fix removal of VA calendar from list
JohnRDOrazio Nov 29, 2024
b0eed3c
use JsonData class to determine path for national or diocesan calendar
JohnRDOrazio Nov 29, 2024
bbf9597
try not to stop when datapath is unreadable
JohnRDOrazio Nov 29, 2024
b67f103
can't use file_exists on url
JohnRDOrazio Nov 29, 2024
fc55b77
be a bit more lenient on requesting diocesan locales
JohnRDOrazio Nov 29, 2024
e65fad1
attempt early return when checking URL and header not 200
JohnRDOrazio Nov 29, 2024
b089d7b
try to determine dataPath for calendar source files
JohnRDOrazio Nov 29, 2024
f58e000
sourceFile will exist, need to override for calendar sources
JohnRDOrazio Nov 29, 2024
e16f109
determine dataPath for calendar i18n source checks
JohnRDOrazio Nov 29, 2024
23807af
try escaping dashes?
JohnRDOrazio Nov 29, 2024
255e9a9
remove unnecessary props from wider region caldata
JohnRDOrazio Nov 29, 2024
6cd8035
remove $schema from required properties
JohnRDOrazio Nov 29, 2024
5414623
better handling of suppressed events that need to be reinstated
JohnRDOrazio Nov 29, 2024
8e4fdbe
regenerated i18n/litcal.pot from source files
github-actions[bot] Nov 29, 2024
a5de3b0
Update translation files
weblate Nov 29, 2024
04b40e8
purge suppressed and reinstated events that fall out of the liturgica…
JohnRDOrazio Nov 29, 2024
ff314e1
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
55d67e2
regenerated i18n/litcal.pot from source files
github-actions[bot] Nov 29, 2024
55d42be
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
bb750f6
Update translation files
weblate Nov 29, 2024
277c7e2
add suppressed_events and reinstated_events to calendar metadata
JohnRDOrazio Nov 29, 2024
5fec46e
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
f0bc0e3
fix typo on unset key while purging data
JohnRDOrazio Nov 29, 2024
561ef9a
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
cdc706b
only output key and date in suppressed_events and reinstated_events m…
JohnRDOrazio Nov 29, 2024
6dd7561
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
2ada2e2
regenerated i18n/litcal.pot from source files
github-actions[bot] Nov 29, 2024
208a909
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
17c69f5
Update translation files
weblate Nov 29, 2024
3e95a46
fix schema for suppressed_events and reinstated_events in calendar me…
JohnRDOrazio Nov 29, 2024
bf280d2
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
c25efc7
do not require color property for wider region events
JohnRDOrazio Nov 29, 2024
bfb9c2f
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
9a11acf
do not require day and month properties for wider region events
JohnRDOrazio Nov 29, 2024
e304d6b
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
02f5df8
allow group property in diocesan calendar metadata
JohnRDOrazio Nov 29, 2024
eb2de6d
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
abf8f2d
remove day/month from setProperty action
JohnRDOrazio Nov 29, 2024
01347b3
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
bc76a6f
reinstate capture group
JohnRDOrazio Nov 29, 2024
78e484f
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
5205dae
try intersecting oneOf with anyOf?
JohnRDOrazio Nov 29, 2024
6b29dd0
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
5ff069e
avoid nested anyOf / oneOf
JohnRDOrazio Nov 29, 2024
072c378
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
541d1a2
try changing the order of anyOf items...
JohnRDOrazio Nov 29, 2024
740cd46
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
3a6fad6
avoid nested anyOf, allow name for moveFestivity
JohnRDOrazio Nov 29, 2024
9117a1d
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
cb9b68a
the match is no longer on index 1, could be 2 or 3
JohnRDOrazio Nov 29, 2024
080f82c
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
4af53c8
allow name property in diocesan calendar schema
JohnRDOrazio Nov 29, 2024
2c33030
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
b2fa090
fix diocesan calendar event keys on events path
JohnRDOrazio Nov 29, 2024
0df8417
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
bbc63e7
fix key=>value pair in groningen i18n data
JohnRDOrazio Nov 29, 2024
583c454
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
b2b73d9
allow name property in wider region calendar schema
JohnRDOrazio Nov 29, 2024
e667606
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
abcea24
remove data_path and i18n_path props from missals route
JohnRDOrazio Nov 29, 2024
a151c0a
Merge remote-tracking branch 'origin/development' into development
weblate Nov 29, 2024
2b034a4
determine dataPath for missals
JohnRDOrazio Nov 30, 2024
6b0d79f
Merge remote-tracking branch 'origin/development' into development
weblate Nov 30, 2024
ada5f55
remove data_path from Missals schema
JohnRDOrazio Nov 30, 2024
549a63a
Merge remote-tracking branch 'origin/development' into development
weblate Nov 30, 2024
6e1a744
add name and year_limits to required properties in Missals path schema
JohnRDOrazio Nov 30, 2024
932c513
Merge remote-tracking branch 'origin/development' into development
weblate Nov 30, 2024
c1afa3e
Translated using Weblate (French)
JohnRDOrazio Nov 30, 2024
8d6fb70
Translated using Weblate (French)
JohnRDOrazio Nov 30, 2024
d374c28
Translated using Weblate (French)
JohnRDOrazio Nov 30, 2024
216fb53
Translated using Weblate (French)
JohnRDOrazio Nov 30, 2024
3bdfe8d
Merge pull request #269 from Liturgical-Calendar/weblate
JohnRDOrazio Nov 30, 2024
fd74c06
for patch requests, payload is the body, no need for a `payload` prop…
JohnRDOrazio Nov 30, 2024
b9a53ee
extract i18n data from payload
JohnRDOrazio Dec 1, 2024
4145051
restrict name extraction to createNew and setProperty:name and makePa…
JohnRDOrazio Dec 1, 2024
90fbf8b
allow url property for setProperty actions
JohnRDOrazio Dec 1, 2024
2dbe69c
fixes #248 San Nicola memoria obbligatoria dal 2017 in Italia
JohnRDOrazio Dec 1, 2024
cfb06cd
add messages feedback on national calendar event actions
JohnRDOrazio Dec 1, 2024
b9f15a8
regenerated i18n/litcal.pot from source files
github-actions[bot] Dec 1, 2024
7047596
Translated using Weblate (French)
chrissherren Dec 1, 2024
dceac1e
Translated using Weblate (French)
chrissherren Dec 1, 2024
bb9322d
Translated using Weblate (French)
chrissherren Dec 1, 2024
d9eed47
Translated using Weblate (French)
chrissherren Dec 1, 2024
a307152
Translated using Weblate (French)
chrissherren Dec 1, 2024
2f8ed58
Merge remote-tracking branch 'origin/development' into development
weblate Dec 1, 2024
5fcdc5d
Update translation files
weblate Dec 1, 2024
7edee5e
update grade_lcl and grade_abbr properties on action setProperty:grade
JohnRDOrazio Dec 1, 2024
f0dd69d
Merge remote-tracking branch 'origin/development' into development
weblate Dec 1, 2024
ed706fe
regenerated i18n/litcal.pot from source files
github-actions[bot] Dec 1, 2024
8e590ea
Merge remote-tracking branch 'origin/development' into development
weblate Dec 1, 2024
78c1188
Update translation files
weblate Dec 1, 2024
1570b94
fix grade_lcl and grade_abbr updates on action setProperty:grade
JohnRDOrazio Dec 1, 2024
2219b51
Merge remote-tracking branch 'origin/development' into development
weblate Dec 1, 2024
b3f4fec
fix setGradeAbbreviation and update grade_lcl
JohnRDOrazio Dec 1, 2024
a5a8ad3
Merge remote-tracking branch 'origin/development' into development
weblate Dec 1, 2024
301e4cf
do not enforce allowed origins on localhost
JohnRDOrazio Dec 2, 2024
e126ed8
Merge remote-tracking branch 'origin/development' into development
weblate Dec 2, 2024
a903e60
refactor diocesan `overrides` to `settings`
JohnRDOrazio Dec 2, 2024
1847191
Merge remote-tracking branch 'origin/development' into development
weblate Dec 2, 2024
d7cb232
write diocesan calendar i18n data on update
JohnRDOrazio Dec 2, 2024
e40cc27
Merge remote-tracking branch 'origin/development' into development
weblate Dec 2, 2024
8f42021
add checks for i18n folder and files
JohnRDOrazio Dec 3, 2024
8b57f71
Merge remote-tracking branch 'origin/development' into development
weblate Dec 3, 2024
769a91d
ignore locale for delete requests
JohnRDOrazio Dec 4, 2024
c6b4f2b
Merge remote-tracking branch 'origin/development' into development
weblate Dec 4, 2024
2928a14
[Bug]: if a national calendar moves a celebration that was suppressed…
JohnRDOrazio Dec 5, 2024
771a4fe
put env vars in tasks.json
JohnRDOrazio Dec 5, 2024
db7b9fe
Merge pull request #272 from Liturgical-Calendar/JohnRDOrazio/issue271
JohnRDOrazio Dec 5, 2024
be2c01a
Merge remote-tracking branch 'origin/development' into development
weblate Dec 5, 2024
0b71eca
regenerated i18n/litcal.pot from source files
github-actions[bot] Dec 5, 2024
20b38f8
Merge remote-tracking branch 'origin/development' into development
weblate Dec 5, 2024
19ba812
Update translation files
weblate Dec 5, 2024
f4f785f
move calculation of christmas weekdays
JohnRDOrazio Dec 6, 2024
bdbd7ab
a few aesthetic fixes
JohnRDOrazio Dec 6, 2024
b9b9785
remove blank line at end of control structure
JohnRDOrazio Dec 6, 2024
a8ca477
christmas weekdays should not be created when oblig memorial
JohnRDOrazio Dec 6, 2024
7c97981
Merge pull request #274 from Liturgical-Calendar/JohnRDOrazio/issue273
JohnRDOrazio Dec 6, 2024
adc22ee
Merge remote-tracking branch 'origin/development' into development
weblate Dec 6, 2024
f93fddb
regenerated i18n/litcal.pot from source files
github-actions[bot] Dec 6, 2024
c341472
Merge remote-tracking branch 'origin/development' into development
weblate Dec 6, 2024
59ebbf5
Update translation files
weblate Dec 6, 2024
1f0c94c
when the celebration cannot be moved, remove it if it exists
JohnRDOrazio Dec 6, 2024
0603c98
Merge pull request #275 from Liturgical-Calendar:JohnRDOrazio/issue271
JohnRDOrazio Dec 6, 2024
7537f7d
Merge remote-tracking branch 'origin/development' into development
weblate Dec 6, 2024
13bad99
regenerated i18n/litcal.pot from source files
github-actions[bot] Dec 6, 2024
a4ec119
Merge remote-tracking branch 'origin/development' into development
weblate Dec 6, 2024
ef1e3eb
Update translation files
weblate Dec 6, 2024
ce74c13
Merge pull request #270 from Liturgical-Calendar/weblate
JohnRDOrazio Dec 6, 2024
a8551f7
Translated using Weblate (German)
JohnRDOrazio Dec 6, 2024
a012ac5
Translated using Weblate (Spanish)
JohnRDOrazio Dec 6, 2024
60de5ec
Translated using Weblate (French)
JohnRDOrazio Dec 6, 2024
ab34698
Translated using Weblate (Italian)
JohnRDOrazio Dec 6, 2024
9d39cb0
Translated using Weblate (Portuguese)
JohnRDOrazio Dec 6, 2024
f08e383
Translated using Weblate (Dutch)
JohnRDOrazio Dec 6, 2024
0bbbe41
Merge pull request #276 from Liturgical-Calendar/weblate
JohnRDOrazio Dec 6, 2024
0eaaef9
Translated using Weblate (French)
chrissherren Dec 6, 2024
1155720
fix NationalCalendar schema (name is not required for makePatron acti…
JohnRDOrazio Dec 8, 2024
5a99035
Merge remote-tracking branch 'origin/development' into development
weblate Dec 8, 2024
6f16f13
correctly handle cases where ImmaculateHeart is suppressed
JohnRDOrazio Dec 8, 2024
8553eb8
Merge remote-tracking branch 'origin/development' into development
weblate Dec 8, 2024
51293b1
regenerated i18n/litcal.pot from source files
github-actions[bot] Dec 8, 2024
2ff1d17
Merge remote-tracking branch 'origin/development' into development
weblate Dec 8, 2024
95e33b3
Update translation files
weblate Dec 8, 2024
191d324
Immaculate Conception suppresses II Sun Advent in Italy since 2024
JohnRDOrazio Dec 10, 2024
e83a21e
Merge remote-tracking branch 'origin/development' into development
weblate Dec 10, 2024
8d0557c
regenerated i18n/litcal.pot from source files
github-actions[bot] Dec 10, 2024
c56d676
Merge remote-tracking branch 'origin/development' into development
weblate Dec 10, 2024
fd78000
Update translation files
weblate Dec 10, 2024
0bdb50e
Bump squizlabs/php_codesniffer from 3.11.1 to 3.11.2
dependabot[bot] Dec 16, 2024
b16ac55
fix comment indentation
JohnRDOrazio Dec 16, 2024
69bcc37
Merge remote-tracking branch 'origin/development' into development
weblate Dec 16, 2024
dacbc60
regenerated i18n/litcal.pot from source files
github-actions[bot] Dec 16, 2024
ffa22b3
Merge remote-tracking branch 'origin/development' into development
weblate Dec 16, 2024
cb0e69d
Update translation files
weblate Dec 16, 2024
a6762ba
fix whitespaces
JohnRDOrazio Dec 16, 2024
d47c2b9
Merge remote-tracking branch 'origin/development' into development
weblate Dec 16, 2024
66a5d0b
regenerated i18n/litcal.pot from source files
github-actions[bot] Dec 16, 2024
e58ee4d
Merge remote-tracking branch 'origin/development' into development
weblate Dec 16, 2024
0f65efa
Update translation files
weblate Dec 16, 2024
732d39f
die early on options request
JohnRDOrazio Dec 21, 2024
8116a2d
Merge remote-tracking branch 'origin/development' into development
weblate Dec 21, 2024
0aa7e82
Merge pull request #279 from Liturgical-Calendar/dependabot/composer/…
JohnRDOrazio Dec 22, 2024
20bebf5
Merge remote-tracking branch 'origin/development' into development
weblate Dec 22, 2024
200c912
Translated using Weblate (French)
JohnRDOrazio Dec 22, 2024
a654940
Bump swaggest/json-schema from 0.12.42 to 0.12.43
dependabot[bot] Dec 23, 2024
b3ec3f1
Merge pull request #280 from Liturgical-Calendar/dependabot/composer/…
JohnRDOrazio Dec 23, 2024
7532425
Merge remote-tracking branch 'origin/development' into development
weblate Dec 23, 2024
7b237bb
Translated using Weblate (French)
chrissherren Dec 23, 2024
75c1e1b
Merge pull request #277 from Liturgical-Calendar/weblate
JohnRDOrazio Dec 23, 2024
60a57c8
Christmas is fixed not mobile!
JohnRDOrazio Dec 28, 2024
a1c6a5c
better handling of API_BASE_PATH definition
JohnRDOrazio Dec 28, 2024
03ea14c
create a dockerfile to easily run the API
JohnRDOrazio Dec 28, 2024
f88aa98
optimize the final docker image
JohnRDOrazio Dec 28, 2024
76ca536
ensure php reqd exts enabled in final docker image
JohnRDOrazio Dec 28, 2024
2a82508
can't use alpine, doesn't have locales
JohnRDOrazio Dec 28, 2024
86791b7
running composer install in the same run should optimize
JohnRDOrazio Dec 28, 2024
2aaa467
php8.4 is 1.09GB instead of 1.07 of php8.3
JohnRDOrazio Dec 28, 2024
eba1285
refactor last remnants of hardcoded JsonData paths
JohnRDOrazio Dec 29, 2024
9016bf1
add yaml support to dockerfile
JohnRDOrazio Dec 29, 2024
880d15f
regenerated i18n/litcal.pot from source files
github-actions[bot] Dec 29, 2024
fb3e6a4
Update translation files
weblate Dec 29, 2024
a359f4d
try renaming to Dockerfile.dockerignore?
JohnRDOrazio Dec 30, 2024
1b1c9d4
Merge remote-tracking branch 'origin/development' into development
weblate Dec 30, 2024
fcc3388
copy only needed files for docker image
JohnRDOrazio Dec 30, 2024
d70343f
Merge remote-tracking branch 'origin/development' into development
weblate Dec 30, 2024
d9545cc
Merge pull request #281 from Liturgical-Calendar/weblate
JohnRDOrazio Dec 31, 2024
1f56707
we need more CLI workers for Storybook for example
JohnRDOrazio Jan 2, 2025
3ffb76e
only expose locales that are fully translated, to avoid errors
JohnRDOrazio Jan 2, 2025
6f4b403
fix locales array
JohnRDOrazio Jan 2, 2025
cac392d
finalize README for v4
JohnRDOrazio Jan 3, 2025
ee2aac3
update API_VERSION to 4.0
JohnRDOrazio Jan 3, 2025
340f937
multiline function call not indented correctly
JohnRDOrazio Jan 3, 2025
c4ae0ba
Merge branch 'master' into development
JohnRDOrazio Jan 3, 2025
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
Prev Previous commit
Next Next commit
refactor from diocese index.json to /calendars route
JohnRDOrazio committed Nov 28, 2024
commit 74b45a406b499cbcf941f7cfb5ff5536be0e410d
10 changes: 4 additions & 6 deletions src/Params/EventsParams.php
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ class EventsParams
public ?string $DiocesanCalendar = null;
private array $SupportedNationalCalendars = [];
private array $SupportedDiocesanCalendars = [];
private static ?object $calendarsMetadata = null;
public readonly object $calendarsMetadata;
private static string $lastError = '';

public const ALLOWED_PARAMS = [
@@ -79,11 +79,9 @@ public function __construct(array $DATA = [])
$this->Locale = LitLocale::LATIN;
}

if (null === EventsParams::$calendarsMetadata) {
EventsParams::$calendarsMetadata = json_decode(file_get_contents(API_BASE_PATH . Route::CALENDARS));
}
$this->SupportedDiocesanCalendars = EventsParams::$calendarsMetadata->diocesan_calendars_keys;
$this->SupportedNationalCalendars = EventsPArams::$calendarsMetadata->national_calendars_keys;
$this->calendarsMetadata = json_decode(file_get_contents(API_BASE_PATH . Route::CALENDARS->value))->litcal_metadata;
$this->SupportedDiocesanCalendars = $this->calendarsMetadata->diocesan_calendars_keys;
$this->SupportedNationalCalendars = $this->calendarsMetadata->national_calendars_keys;


if (count($DATA)) {
63 changes: 32 additions & 31 deletions src/Paths/Events.php
Original file line number Diff line number Diff line change
@@ -10,14 +10,14 @@
use LiturgicalCalendar\Api\Enum\RequestMethod;
use LiturgicalCalendar\Api\Enum\RequestContentType;
use LiturgicalCalendar\Api\Enum\AcceptHeader;
use LiturgicalCalendar\Api\Enum\JsonData;
use LiturgicalCalendar\Api\Params\EventsParams;

class Events
{
public static Core $Core;
private static array $FestivityCollection = [];
private static array $LatinMissals = [];
private static ?array $DioceseIndex = null;
private static ?object $WiderRegionData = null;
private static ?object $NationalData = null;
private static ?object $DiocesanData = null;
@@ -35,6 +35,9 @@ class Events
* - Initialize the instance of the Core class
* - Set the request path parts
* - Initialize a new EventsParams object
* - Initialize the WorldDioceses object from the world_dioceses.json file
*
* @throws \Exception if there is an issue with reading the world_dioceses.json file
*/
public function __construct(array $requestPathParts = [])
{
@@ -57,26 +60,6 @@ private static function retrieveLatinMissals(): void
});
}

/**
* Loads the JSON data for the diocesan calendars index.
*
* This file is used to keep track of which diocesan calendars are available
* and their respective paths.
*/
private static function retrieveDioceseIndex(): void
{
$DioceseIndexContents = file_exists("jsondata/sourcedata/nations/index.json") ? file_get_contents("jsondata/sourcedata/nations/index.json") : null;
if (null === $DioceseIndexContents || false === $DioceseIndexContents) {
echo self::produceErrorResponse(StatusCode::NOT_FOUND, "path jsondata/sourcedata/nations/index.json not found");
die();
}
self::$DioceseIndex = json_decode($DioceseIndexContents);
if (json_last_error() !== JSON_ERROR_NONE) {
echo self::produceErrorResponse(StatusCode::SERVICE_UNAVAILABLE, json_last_error_msg());
die();
}
}

/**
* Validate the request path parameters.
*
@@ -219,22 +202,26 @@ private function handleRequestParams(): void
/**
* Loads the JSON data for the specified diocesan calendar.
*
* If the diocese is not found in the diocesan calendars index or in the `jsondata/sourcedata/nations/{nation}/` directory, the response will be a JSON error response with a status code of 404 Not Found.
* If the diocese is not found in the diocesan calendars index, the response will be a JSON error response with a status code of 400 Bad Request.
* If the diocese is found in the diocesan calendars index but not in the `jsondata/sourcedata/nations/{nation}/` directory, the response will be a JSON error response with a status code of 503 Service Unavailable.
* If the payload is not valid according to {@see LitSchema::DIOCESAN}, the response will be a JSON error response with a status code of 422 Unprocessable Content.
*
* @return void
*/
private function loadDiocesanData(): void
{
if ($this->EventsParams->DiocesanCalendar !== null) {
$DiocesanData = array_values(array_filter(self::$DioceseIndex, function ($el) {
$DiocesanData = array_values(array_filter($this->EventsParams->calendarsMetadata->diocesan_calendars, function ($el) {
return $el->calendar_id === $this->EventsParams->DiocesanCalendar;
}));
if (count($DiocesanData) === 1) {
$this->EventsParams->NationalCalendar = $DiocesanData[0]->nation;
$diocesanDataFile = $DiocesanData[0]->path;
$diocesanDataFile = strtr(
JsonData::DIOCESAN_CALENDARS_FILE,
[
'{nation}' => $this->EventsParams->NationalCalendar,
'{diocese}' => $this->EventsParams->DiocesanCalendar,
'{diocese_name}' => $DiocesanData[0]->diocese
]
);
if (file_exists($diocesanDataFile)) {
self::$DiocesanData = json_decode(file_get_contents($diocesanDataFile));
} else {
@@ -243,7 +230,7 @@ private function loadDiocesanData(): void
}
} else {
$description = "unknown diocese `{$this->EventsParams->DiocesanCalendar}`, supported values are: ["
. implode(',', array_column(self::$DioceseIndex, 'calendar_id')) . "]";
. implode(',', $this->EventsParams->calendarsMetadata->diocesan_calendars) . "]";
echo self::produceErrorResponse(StatusCode::BAD_REQUEST, $description);
die();
}
@@ -263,16 +250,31 @@ private function loadDiocesanData(): void
private function loadNationalAndWiderRegionData(): void
{
if ($this->EventsParams->NationalCalendar !== null) {
$nationalDataFile = "jsondata/sourcedata/nations/" . $this->EventsParams->NationalCalendar . "/" . $this->EventsParams->NationalCalendar . ".json";
$nationalDataFile= strtr(
JsonData::NATIONAL_CALENDARS_FILE,
[
'{nation}' => $this->EventsParams->NationalCalendar
]
);
if (file_exists($nationalDataFile)) {
self::$NationalData = json_decode(file_get_contents($nationalDataFile));
if (json_last_error() === JSON_ERROR_NONE) {
if (property_exists(self::$NationalData, "settings") && property_exists(self::$NationalData->settings, "locale")) {
$this->EventsParams->Locale = self::$NationalData->settings->locale;
}
if (property_exists(self::$NationalData, "metadata") && property_exists(self::$NationalData->metadata, "wider_region")) {
$widerRegionDataFile = self::$NationalData->metadata->wider_region->json_file;
$widerRegionI18nFile = self::$NationalData->metadata->wider_region->i18n_file;
$widerRegionDataFile = strtr(
JsonData::WIDER_REGIONS_FILE,
[
'{wider_region}' => self::$NationalData->metadata->wider_region
]
);
$widerRegionI18nFile = strtr(
JsonData::WIDER_REGIONS_I18N_FOLDER,
[
'{wider_region}' => self::$NationalData->metadata->wider_region
]
) . $this->EventsParams->Locale. '.json';
if (file_exists($widerRegionI18nFile)) {
$widerRegionI18nData = json_decode(file_get_contents($widerRegionI18nFile));
if (json_last_error() === JSON_ERROR_NONE && file_exists($widerRegionDataFile)) {
@@ -701,7 +703,6 @@ public function init(array $requestPathParts = [])

self::$requestPathParts = $requestPathParts;
self::retrieveLatinMissals();
self::retrieveDioceseIndex();
$this->handleRequestParams();
$this->loadDiocesanData();
$this->loadNationalAndWiderRegionData();