diff options
author | Yorhel <git@yorhel.nl> | 2019-07-25 14:30:04 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-07-25 14:36:21 +0200 |
commit | f296495a912ce759df11c43e78b4552788bdbff2 (patch) | |
tree | 0c10802de65fb7c8475722e12234bff5eb980628 /lib/VN3/Release/JS.pm | |
parent | 0f3cfeb85caec6424bcbea47142eefbf8011636b (diff) |
Merge the v3 branch into separate namespace + fix Docker stuff (again)
I was getting tired of having to keep two branches up-to-date with the
latest developments, so decided to throw v3 into the same branch - just
different files (...which will get mostly rewritten again soon). The two
versions aren't very different in terms of dependencies, build system
and support code, so they can now properly share files. Added a section
to the README to avoid confusion.
This merge also makes it easier to quickly switch between the different
versions, which is handy for development. It's even possible to run both
at the same time, but my scripts use the same port so that needs a
workaround.
And it's amazing how often I break the Docker scripts.
Diffstat (limited to 'lib/VN3/Release/JS.pm')
-rw-r--r-- | lib/VN3/Release/JS.pm | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/VN3/Release/JS.pm b/lib/VN3/Release/JS.pm new file mode 100644 index 00000000..c562d4c5 --- /dev/null +++ b/lib/VN3/Release/JS.pm @@ -0,0 +1,32 @@ +package VN3::Release::JS; + +use VN3::Prelude; + + +my $OUT = tuwf->compile({ aoh => { + id => { id => 1 }, + title => {}, + lang => { type => 'array', values => {} }, +}}); + + +# Fetch all releases assigned to a VN +json_api '/js/release.json', { + vid => { id => 1 }, +}, sub { + my $vid = shift->{vid}; + + my $r = tuwf->dbAlli(q{ + SELECT r.id, r.title + FROM releases r + JOIN releases_vn rv ON rv.id = r.id + WHERE NOT r.hidden + AND rv.vid =}, \$vid, q{ + ORDER BY r.id + }); + enrich_list1 lang => id => id => sub { sql 'SELECT id, lang FROM releases_lang WHERE id IN', $_[0], 'ORDER BY id, lang' }, $r; + + tuwf->resJSON({ReleaseResult => $OUT->analyze->coerce_for_json($r)}); +}; + +1; |