Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
e89b2e0a02 | |||
c7bee5009a | |||
cad957394e | |||
8eb7918f7f | |||
b7970f6af8 | |||
4580709d29 | |||
2bf0412629 |
BIN
resources/webapp/favicon.ico
Normal file
BIN
resources/webapp/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
@ -7,6 +7,7 @@ public class Service implements Serializable {
|
|||||||
int id
|
int id
|
||||||
private LocalDate date
|
private LocalDate date
|
||||||
ServiceType serviceType
|
ServiceType serviceType
|
||||||
|
String description
|
||||||
|
|
||||||
public boolean equals(Object thatObj) {
|
public boolean equals(Object thatObj) {
|
||||||
if (thatObj == null) return false
|
if (thatObj == null) return false
|
||||||
|
@ -13,5 +13,5 @@ public class NLSongsContext {
|
|||||||
public static String makeUrl(Service service, Song song) {
|
public static String makeUrl(Service service, Song song) {
|
||||||
return mediaBaseUrl + '/' + service.@date.toString('yyyy-MM-dd') + '_' +
|
return mediaBaseUrl + '/' + service.@date.toString('yyyy-MM-dd') + '_' +
|
||||||
service.serviceType.name().toLowerCase() + '_' +
|
service.serviceType.name().toLowerCase() + '_' +
|
||||||
song.name.replaceAll(/[\s'"\\\/\?!]/, '') + '.ogg' }
|
song.name.replaceAll(/[\s'"\\\/\?!]/, '') + '.mp3' }
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ CREATE TABLE IF NOT EXISTS services (
|
|||||||
id SERIAL,
|
id SERIAL,
|
||||||
date DATE NOT NULL,
|
date DATE NOT NULL,
|
||||||
service_type VARCHAR(16) DEFAULT NULL,
|
service_type VARCHAR(16) DEFAULT NULL,
|
||||||
|
description VARCHAR(255) DEFAULT NULL,
|
||||||
CONSTRAINT uc_serviceTypeAndDate UNIQUE (date, service_type),
|
CONSTRAINT uc_serviceTypeAndDate UNIQUE (date, service_type),
|
||||||
PRIMARY KEY (id));
|
PRIMARY KEY (id));
|
||||||
|
|
||||||
|
@ -65,7 +65,11 @@ table {
|
|||||||
|
|
||||||
pre { margin-left: 1rem; }
|
pre { margin-left: 1rem; }
|
||||||
|
|
||||||
h3 { margin: 1rem 0; }
|
h2 {
|
||||||
|
border-bottom: solid 2px $dark;
|
||||||
|
margin-top: 2em; }
|
||||||
|
|
||||||
|
h3 { margin: 2rem 0 1rem 0; }
|
||||||
|
|
||||||
dl {
|
dl {
|
||||||
margin: 1rem;
|
margin: 1rem;
|
||||||
@ -75,7 +79,20 @@ table {
|
|||||||
font-family: $monoFont;
|
font-family: $monoFont;
|
||||||
font-weight: bold; }
|
font-weight: bold; }
|
||||||
|
|
||||||
& > dd { padding: 0 0 0.5rem 1rem; } } }
|
& > dd { padding: 0 0 0.5rem 1rem; } }
|
||||||
|
|
||||||
|
table.method-summary {
|
||||||
|
padding: 0 2rem;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
th {
|
||||||
|
border-bottom: solid thin $dark;
|
||||||
|
text-align: left; }
|
||||||
|
|
||||||
|
th.action, td.action { width: 6em; }
|
||||||
|
th.path, td.path { width: 17em; }
|
||||||
|
th.public, td.public { width: 4em; }
|
||||||
|
} }
|
||||||
|
|
||||||
@include forSize(notSmall) {
|
@include forSize(notSmall) {
|
||||||
|
|
||||||
@ -109,7 +126,7 @@ table {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
& > h2 { display: none; }
|
& > h2 { display: none; }
|
||||||
& > h2.song-name, & > h2.service-date { display: block; }
|
& > h2.song-name, & > h2.service-desc { display: block; }
|
||||||
|
|
||||||
& > nav > ul > li {
|
& > nav > ul > li {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
</header>
|
</header>
|
||||||
<section id=api-overview>
|
<section id=api-overview>
|
||||||
The New Life Songs database exposes a REST API. This allows
|
The New Life Songs database exposes a REST API. This allows
|
||||||
programatic access and modification to the data. Version 1 of the
|
programatic access to and modification of the data. Version 1 of
|
||||||
API defines several endpoints, all of which are built off of
|
the API defines several endpoints, all of which are built off of
|
||||||
<code>http://newlifesongs.jdbernard.com/api/v1</code> as a base
|
<code>http://newlifesongs.jdbernard.com/api/v1</code> as a base
|
||||||
URL.
|
URL.
|
||||||
|
|
||||||
@ -64,6 +64,46 @@
|
|||||||
"Michael W. Smith"
|
"Michael W. Smith"
|
||||||
]
|
]
|
||||||
}</pre>
|
}</pre>
|
||||||
|
<h3>Method Summary</h3>
|
||||||
|
<table class=method-summary>
|
||||||
|
<thead>
|
||||||
|
<tr><th class=action>HTTP Action</th>
|
||||||
|
<th class=path>Path</th>
|
||||||
|
<th class=desc>Description</th>
|
||||||
|
<th class=public>Public?</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td class=action>GET</td>
|
||||||
|
<td class=path><code>/songs</code></td>
|
||||||
|
<td class=desc>Retrieve all songs.</td>
|
||||||
|
<td class=public>yes</td></tr>
|
||||||
|
<tr><td class=acion>POST</td>
|
||||||
|
<td class=path><code>/songs</code></td>
|
||||||
|
<td class=desc>Create a new song record.</td>
|
||||||
|
<td class=public>no</td></tr>
|
||||||
|
<tr><td class=acion>GET</td>
|
||||||
|
<td class=path><code>/songs/<songId></code></td>
|
||||||
|
<td class=desc>Retrieve a single record.</td>
|
||||||
|
<td class=public>yes</td></tr>
|
||||||
|
<tr><td class=acion>PUT</td>
|
||||||
|
<td class=path><code>/songs/<songId></code></td>
|
||||||
|
<td class=desc>Update a song record.</td>
|
||||||
|
<td class=public>no</td></tr>
|
||||||
|
<tr><td class=acion>DELETE</td>
|
||||||
|
<td class=path><code>/songs/<songId></code></td>
|
||||||
|
<td class=desc>Delete a song record.</td>
|
||||||
|
<td class=public>no</td></tr>
|
||||||
|
<tr><td class=acion>GET</td>
|
||||||
|
<td class=path><code>/songs/forService/<serviceId></code></td>
|
||||||
|
<td class=desc>Retrieve all songs performed in a given service.</td>
|
||||||
|
<td class=public>yes</td></tr>
|
||||||
|
<tr><td class=acion>GET</td>
|
||||||
|
<td class=path><code>/songs/byArtist/<artist></code></td>
|
||||||
|
<td class=desc>Retrieve all songs performed by a given artist.</td>
|
||||||
|
<td class=public>yes</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
<ul class=method-list>
|
<ul class=method-list>
|
||||||
<li><h3><code>GET /songs</code></h3>
|
<li><h3><code>GET /songs</code></h3>
|
||||||
|
|
||||||
@ -71,22 +111,22 @@
|
|||||||
<p><h4>Response</h4>
|
<p><h4>Response</h4>
|
||||||
A list of <a href="song-object">song objects</a>
|
A list of <a href="song-object">song objects</a>
|
||||||
|
|
||||||
<h4>Example</h4>
|
<p><h4>Example</h4>
|
||||||
<pre>
|
<pre>
|
||||||
GET http://newlifesongs.jdbernard.com/api/v1/songs</pre>
|
GET http://newlifesongs.jdbernard.com/api/v1/songs</pre>
|
||||||
<p><pre>
|
<p><pre>
|
||||||
HTTP/1.1 200 OK
|
HTTP/1.1 200 OK
|
||||||
Content-Length: 5146
|
Content-Length: 433
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
|
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
|
||||||
Server: Jetty(6.1.25)
|
|
||||||
|
|
||||||
[{"id":1,"name":"Welcome Holy Spirit","artists":["Mark Condon"]},
|
[{"id":1,"name":"Welcome Holy Spirit","artists":["Mark Condon"]},
|
||||||
{"id":3,"name":"Let's Sing Praises to our God","artists":["Traditional"]},
|
{"id":3,"name":"Let's Sing Praises to our God","artists":["Traditional"]},
|
||||||
{"id":5,"name":"Blessed Assurance","artists":["Frances J. Crosby"]},
|
{"id":5,"name":"Blessed Assurance","artists":["Frances J. Crosby"]},
|
||||||
{"id":8,"name":"Here I Am To Worship","artists":["Tim Hughes", "Chris Tomlin", "Michael W. Smith"]},
|
{"id":8,"name":"Here I Am To Worship","artists":["Tim Hughes", "Chris Tomlin", "Michael W. Smith"]},
|
||||||
{"id":12,"name":"Healer","artists":["Kari Jobe", "Hillsong"]},
|
{"id":12,"name":"Healer","artists":["Kari Jobe", "Hillsong"]},
|
||||||
{"id":15,"name":"I Am Free","artists":["Newsboys"]}]</pre></li>
|
{"id":15,"name":"I Am Free","artists":["Newsboys"]}]
|
||||||
|
</pre></li>
|
||||||
|
|
||||||
<li><h3><code>POST /songs</code></h3>
|
<li><h3><code>POST /songs</code></h3>
|
||||||
|
|
||||||
@ -105,10 +145,185 @@ Server: Jetty(6.1.25)
|
|||||||
The newly-created song record.
|
The newly-created song record.
|
||||||
|
|
||||||
<p><h4>Example</h4>
|
<p><h4>Example</h4>
|
||||||
|
<pre>
|
||||||
|
</pre></li>
|
||||||
|
|
||||||
|
<li><h3><code>GET /songs/<songId></code></h3>
|
||||||
|
|
||||||
|
<p>Retrieve song data for the given song id.
|
||||||
|
|
||||||
|
<p><h4>Response</h4>
|
||||||
|
A <a href="song-object">song object</a>.
|
||||||
|
|
||||||
|
<p><h4>Example</h4>
|
||||||
|
<pre>
|
||||||
|
GET http://newlifesongs.jdbernard.com/api/v1/songs/1</pre>
|
||||||
|
<p><pre>
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Content-Length: 63
|
||||||
|
Content-Type: application/json
|
||||||
|
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
|
||||||
|
|
||||||
|
{"id":1,"name":"Welcome Holy Spirit","artists":["Mark Condon"]}
|
||||||
|
</pre></li>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li><h3><code>PUT /songs/<songId></code></h3>
|
||||||
|
|
||||||
|
<p>Method description
|
||||||
|
<p><h4>Request Body</h4>
|
||||||
|
Request body description
|
||||||
|
|
||||||
|
<p><h4>Response</h4>
|
||||||
|
Return value description
|
||||||
|
|
||||||
|
<p><h4>Example</h4>
|
||||||
|
<pre>
|
||||||
|
</pre></li>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li><h3><code>DELETE /songs/<songId></code></h3>
|
||||||
|
|
||||||
|
<p>Method description
|
||||||
|
<p><h4>Request Body</h4>
|
||||||
|
Request body description
|
||||||
|
|
||||||
|
<p><h4>Response</h4>
|
||||||
|
Return value description
|
||||||
|
|
||||||
|
<p><h4>Example</h4>
|
||||||
|
<pre>
|
||||||
|
</pre></li>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li><h3><code>GET /songs/forService/<serviceId></code></h3>
|
||||||
|
|
||||||
|
<p>Method description
|
||||||
|
<p><h4>Request Body</h4>
|
||||||
|
Request body description
|
||||||
|
|
||||||
|
<p><h4>Response</h4>
|
||||||
|
Return value description
|
||||||
|
|
||||||
|
<p><h4>Example</h4>
|
||||||
|
<pre>
|
||||||
|
GET /api/v1/songs/forService/1 HTTP/1.1</pre>
|
||||||
|
<p><pre>
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Content-Length: 256
|
||||||
|
Content-Type: application/json
|
||||||
|
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
|
||||||
|
|
||||||
|
[{"id":7,"name":"Mighty God","artists":[""]},
|
||||||
|
{"id":8,"name":"Here I Am To Worship","artists":["Tim Hughes: Chris Tomlin, Michael W. Smith"]},
|
||||||
|
{"id":9,"name":"Worthy","artists":[""]},
|
||||||
|
{"id":4,"name":"I Am A Friend Of God","artists":["Israel Houghton"]}]j
|
||||||
|
</pre></li>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li><h3><code>GET /songs/byArtist/<artist></code></h3>
|
||||||
|
|
||||||
|
<p>Method description
|
||||||
|
<p><h4>Request Body</h4>
|
||||||
|
Request body description
|
||||||
|
|
||||||
|
<p><h4>Response</h4>
|
||||||
|
Return value description
|
||||||
|
|
||||||
|
<p><h4>Example</h4>
|
||||||
|
<pre>
|
||||||
|
</pre></li>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<section id=services>
|
<section id=services>
|
||||||
<h2><code>/services</code></h2>
|
<h2><code>/services</code></h2>
|
||||||
|
|
||||||
|
<h3 id=service-object>Service object</h3>
|
||||||
|
A Service object is defined with the following fields:
|
||||||
|
<dl><dt>id</dt>
|
||||||
|
<dd>An identifier unique to this service record among all
|
||||||
|
service records. <em>Type: integer</em></dd>
|
||||||
|
|
||||||
|
<dt>date</dt>
|
||||||
|
<dd>The date of the service. <em>Type: Date</em></dd>
|
||||||
|
|
||||||
|
<dt>serviceType</dt>
|
||||||
|
<dd>Service type. <em>Type: string</em> Valid values:
|
||||||
|
<table><thead><tr><th>Value</th><th>Description</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><code>SUN_AM</code></td>
|
||||||
|
<td>Sunday morning service.</td></tr>
|
||||||
|
<tr><td><code>SUN_PM</code></td>
|
||||||
|
<td>Sunday evening service</td></tr>
|
||||||
|
<tr><td><code>WED</code></td>
|
||||||
|
<td>Wednesday, midweek Bible study.</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<h4>Example</h4>
|
||||||
|
<pre>
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"date": 1235887200000,
|
||||||
|
"serviceType": "SUN_PM"
|
||||||
|
}</pre>
|
||||||
|
|
||||||
|
<h3>Method Summary</h3>
|
||||||
|
<table class=method-summary>
|
||||||
|
<thead>
|
||||||
|
<tr><th class=action>HTTP Action</th>
|
||||||
|
<th class=path>Path</th>
|
||||||
|
<th class=desc>Description</th>
|
||||||
|
<th class=public>Public?</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td class=action>GET</td>
|
||||||
|
<td class=path><code>/services</code></td>
|
||||||
|
<td class=desc>Retrieve all services.</td>
|
||||||
|
<td class=public>yes</td></tr>
|
||||||
|
<tr><td class=acion>POST</td>
|
||||||
|
<td class=path><code>/services</code></td>
|
||||||
|
<td class=desc>Create a new service record.</td>
|
||||||
|
<td class=public>no</td></tr>
|
||||||
|
<tr><td class=acion>GET</td>
|
||||||
|
<td class=path><code>/services/<serviceId></code></td>
|
||||||
|
<td class=desc>Retrieve a single service record.</td>
|
||||||
|
<td class=public>yes</td></tr>
|
||||||
|
<tr><td class=acion>PUT</td>
|
||||||
|
<td class=path><code>/services/<serviceId></code></td>
|
||||||
|
<td class=desc>Update a service record.</td>
|
||||||
|
<td class=public>no</td></tr>
|
||||||
|
<tr><td class=acion>DELETE</td>
|
||||||
|
<td class=path><code>/services/<serviceId></code></td>
|
||||||
|
<td class=desc>Delete a service record.</td>
|
||||||
|
<td class=public>no</td></tr>
|
||||||
|
<tr><td class=acion>GET</td>
|
||||||
|
<td class=path><code>/services/withSong/<serviceId></code></td>
|
||||||
|
<td class=desc>Retrieve all services in which the given song was performed.</td>
|
||||||
|
<td class=public>yes</td></tr>
|
||||||
|
<tr><td class=acion>GET</td>
|
||||||
|
<td class=path><code>/services/byDate/after/<date></code></td>
|
||||||
|
<td class=desc>Retrieve all services after the given date.</td>
|
||||||
|
<td class=public>yes</td></tr>
|
||||||
|
<tr><td class=acion>GET</td>
|
||||||
|
<td class=path><code>/services/byDate/before/<date></code></td>
|
||||||
|
<td class=desc>Retrieve all services before the given date.</td>
|
||||||
|
<td class=public>yes</td></tr>
|
||||||
|
<tr><td class=acion>GET</td>
|
||||||
|
<td class=path><code>/services/byDate/between/<date1>/<date2></code></td>
|
||||||
|
<td class=desc>Retrieve all services between the two given dates.</td>
|
||||||
|
<td class=public>yes</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
<section id=users>
|
<section id=users>
|
||||||
<h2><code>/users</code></h2>
|
<h2><code>/users</code></h2>
|
||||||
|
@ -38,8 +38,8 @@ if (!service) { response.sendError(response.SC_NOT_FOUND); return }
|
|||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<h1><a href="../">New Life Songs</a></h1>
|
<h1><a href="../">New Life Songs</a></h1>
|
||||||
<h2 class=service-date><%= service.@date.toString("yyyy-MM-dd") %> (<%=
|
<h2 class=service-desc><%= service.@date.toString("yyyy-MM-dd") %>: (<%=
|
||||||
service.serviceType.displayName %>)</h2>
|
service.description ?: service.serviceType.displayName %>)</h2>
|
||||||
|
|
||||||
<nav><ul>
|
<nav><ul>
|
||||||
<li><a href="../admin/">Admin</a></li>
|
<li><a href="../admin/">Admin</a></li>
|
||||||
|
@ -45,7 +45,8 @@ songsDB = NLSongsContext.songsDB
|
|||||||
<% songsDB.findAllServices().sort { it.date }.reverse().each { service -> %>
|
<% songsDB.findAllServices().sort { it.date }.reverse().each { service -> %>
|
||||||
<tr><td class=date><a href="../service/<%= service.id %>"><%=
|
<tr><td class=date><a href="../service/<%= service.id %>"><%=
|
||||||
service.@date.toString("yyyy-MM-dd") %></a></td>
|
service.@date.toString("yyyy-MM-dd") %></a></td>
|
||||||
<td class=service-type><%= service.serviceType.displayName %></td></tr><% } %>
|
<td class=service-type><%= service.description ?:
|
||||||
|
service.serviceType.displayName %></td></tr><% } %>
|
||||||
</tbody>
|
</tbody>
|
||||||
<!--<tfoot><tr>
|
<!--<tfoot><tr>
|
||||||
<th class="dt-left">Date</th>
|
<th class="dt-left">Date</th>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
#Mon Mar 23 03:03:08 CDT 2015
|
#Tue Apr 14 15:12:24 CDT 2015
|
||||||
major=2
|
major=2
|
||||||
version.release=true
|
version.release=false
|
||||||
minor=0
|
minor=2
|
||||||
build=101
|
build=13
|
||||||
|
Reference in New Issue
Block a user