phantomwatson / muncie-events-api Goto Github PK
View Code? Open in Web Editor NEWMuncieEvents.com
Home Page: https://muncieevents.com
MuncieEvents.com
Home Page: https://muncieevents.com
/v1/events
endpoints that allows events with specified tags to be excluded from results.withTags[]
and withoutTags[]
arrayAt the top of the generated docs, there's a /muncie_events_api_v1.json
link that doesn't go anywhere.
Use JS to add the .alert-link
class to any link inside of a flash message.
Address vulnerability alerts listed in https://github.com/BallStateCBER/muncie-events-api/network/alerts
Search Console has detected that your site contains event information that would benefit from enhanced Google Search results. Google Search supports an Event rich result that provides a richer user experience for events in search results, including event date, time, description, and ticketing information.
Enabling Event rich results on your site is free, and requires only the proper structured data on your website. Early adopters who have implemented Event rich results have boosted site traffic significantly (read a case study).
This events feature experience will be coming to your market soon!
Replace deprecated josbeir/cakephp-json-api
with https://github.com/FriendsOfCake/crud-json-api.
Use the ErrorHandler provided in the CakePHP-Tools plugin to log externally-referred 404 errors separately from internal errors.
Once the CakePHP 3 version of Muncie Events is online and time fields that store UTC time are implemented, the API should read from those fields instead of time_start
and time_end
, which store non-UTC time without any offset information.
Strip emoji out of new tag names. The best explanation I have for why this is necessary is "Because emoji as tags would be obnoxious and not very useful".
The Muncie Events app does not (currently) add markup to the Events.description
field, most notably resulting in line breaks not turning into <br />
tags.
If the description field
nl2br()
before saving it.The exceptions thrown in ApiController::initialize()
(for incorrect protocol or invalid/missing API key) render HTML error pages instead of JSON error responses.
Once this is fixed, there should be tests written to assert proper error responses.
I'd like to use all of the endpoints of the API to replace redundant backend processing on the main site and redesign it to be more asynchronous. But with all endpoints requiring an API key, that would require either
userToken
Currently, the apikey
query string parameter is the only multi-word parameter that isn't camel-cased.
apikey
apiKey
apiKey
in the docsAllow API key to be passed in the Authorization Header instead of in the query string, which might be preferred by some users and which seems to be generally recommended.
Google Search console reports this:
Search Console has identified that your site is affected by 3 Mobile Usability issues:
Top Issues
The following issues were found on your site:
- Text too small to read
- Clickable elements too close together
- Viewport not set
Event accordion pagination is currently by date range, with the first page starting today and ending at some specified time like two weeks in the future. If the first event in a given category is outside of that range (e.g. three weeks in the future), that category page will first be empty, and the user will have to click 'More events' to see that first event.
Removing pagination from pages other than the front page was an easy solution that seems like it won't result in huge, cumbersome pages for users to load while the numbers of upcoming events are relatively low.
EventsTable::findPaginatedStartingOn()
method would work (but would oddly have a DB call inside that finder)I think that a lot of style rules refer to elements that aren't used in the site anymore. Each selector should be audited, and ones that don't apply to anything anymore should have their rules removed.
GET /users/login
should accept an email and password and, if they match, return user id, name, email, and token (generating Users.token
if it is null)userToken
parameter/users/login
and store the token that's returneduserToken
in any requests that require itlocations
table with name
and address
fieldsevents
tablelocation
fieldlocation
fieldaddress
fieldevents.address
field would mean that either
address
field$event->location->address
) are all uniform and can be more efficiently correctedAdd a public endpoint such as GET /address
that takes a locationName
input and outputs the most recent address associated with that location. In the future, this could be upgraded to use the Google Maps API to determine the canonical address for a location.
// Controller code
/**
* Returns the address most recently associated with the provided location name
*
* @return void
*/
public function getAddress()
{
$location = (string)$this->request->getData('location');
$address = $location ? $this->Events->getAddress($location) : false;
$this->viewBuilder()->setClassName('Json');
$this->set([
'address' => $address,
'_serialize' => ['address']
]);
}
// Table code
/**
* Returns the most recently published address for the provided location name or FALSE if none is found
*
* @param string|null $location Location name
* @return string|boolean
*/
public function getAddress($location)
{
if (!$location) {
return false;
}
/** @var Event|null $result */
$result = $this->find()
->select(['Events.address'])
->where([
'Events.published' => true,
'Events.location' => $location,
'Events.address NOT' => ''
])
->orderDesc('Events.created')
->first();
return $result ? $result->address : false;
}
Perhaps a fun addition to the 'about' page:
created
field)date
field)Once PhantomWatson/muncie-events3#47 is resolved,
$config['Datasources']['default']['encoding']
and $config['Datasources']['test']['encoding']
to 'utf8mb4'
strpos()
, stripos()
, and strlen()
and replace with mb_strpos()
, mb_stripos()
and mb_strlen()
/categories
results need a $category['links']['events']
value (i.e. /v1/events/category/{categoryId}
)$foo['links']
results need to be documented (if intended) or removed from results (if not)'self'
link is documented, but not in results (at least not in /event/{eventID}
results)/event
endpoint need removed$subscription->new_subscriber
to false
if true
when sending messagesnew_subscriber
is true
Welcome to the Muncie Events mailing list. If you did not mean to subscribe, you can click here to unsubscribe. Your subscription is currently configured to email you every [description of frequency] about upcoming [description of selected categories]. If you would ever like to change this, just click the change settings link at the bottom of any message.
Because it's weird that some values have proper examples, and others are just "string".
Instead of continuing to maintain the API documentation manually, consider switching from the JSON:API standard to OpenAPI and using one of the following CakePHP 4 plugins once this site is upgraded to CakePHP 4.
The CakePHP-Setup plugin offers a convenient approach to putting the site into maintenance mode, creating views for database and cache info, and other administrative functions.
Follow this advice to leave app.php
unmodified from how it's delivered by the cakephp/app
repository and put all customizations into app_custom.php
. This will allow for easier upgrading.
POST /user/login
POST /user/register
GET /user/{userId}
(returns name and email address)GET /user/{userId}/events
GET /event-series/{eventSeriesId}
POST /user/forgot-password
POST /event
userToken
in query string:PATCH /user/profile
PATCH /user/password
GET /user/images
POST /image
PATCH /event/{eventId}
$this->request->allowMethod('get')
in all GET
endpointsDELETE /event/{eventId}
DELETE /event-series/{seriesId}
/user/register
/mailing-list/subscribe
(optional userToken
)/mailing-list/subscription
(requires userToken
)/mailing-list/subscription
(requires userToken
)/mailing-list/subscription
(requires userToken
)/tags/autocomplete
Users.email
(so users are no longer able to have different Users.email
and MailingList.email
values)Users.mailing_list_id
gets set for the current user when creating a new record in the MailingList
tableUsers.mailing_list_id
gets set for the current user if it's currently null and the user is
MailingList
tableUsers.mailing_list_id
being setUsers.mailing_list_id
being set, even if the email address doesn't matchProvide a means for users to cancel their API access (null their API key). Mainly in case we start emailing API users and someone wants to mark themselves as not an API user anymore to effectively unsubscribe from those emails.
Any parameters in the query string that aren't recognized should return an error instead of being ignored.
If the Muncie Events website were to be upgraded to CakePHP 3 or 4 in a separate codebase from the API, that would necessitate a lot of redundant code, especially in the model layer. Ideally, these codebases will be combined into a single application, with the API endpoints being routed through the api.
subdomain.
Change the favicon from the CakePHP default to the same one used by the main Muncie Events site.
Throw graceful errors for
YYYY-MM-DD
formatFrozenTime
objectsOnce the CakePHP 3 version of Muncie Events is set up, move all user management over to that site, including key generation/retrieval.
Create an endpoint that returns an iCalendar object for exporting an event to other calendar applications.
In fields that may contain email addresses and URLs (e.g. description
and source
), add an autolink
field that can optionally be included in the request that specifies whether those should be automatically wrapped with links in the response. Note in the API what the default behavior is in the absence of this field.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.