Comments (14)
πJust deployed the latest changes, this should be live now :)
from quotable.
Hi, @lukePeavey. I agree with your suggestions to have a new API of /tags
for a list of tags and to modify existing /quotes
to filter by tag name(s). I think we can have a param of tags that can have tag names separated by a comma, something like /quotes?tags=love,art
or just have /quotes?tag=love
for a single tag name. What do you think?
I'm open to help with APIs when tags are defined in each quote.
from quotable.
I think we can have a param of tags that can have tag names separated by a comma.
I agree, the tags
parameter should accept a list of one or more tags. I was thinking that it could support two types of lists: comma separated (for AND
) or pipe |
separated (for OR
).
So a pipe separated list would match quotes that have any
of the specified tags, whereas a comma separated list would match quotes with all
the specified tags.
Examples
This would match quotes with tags "love" OR
"friendship"
/quotes?tags=love|friendship
This would match quotes with the tags "famous-quotes" AND
"technology"
/quotes?tags=famous-quotes,technology
from quotable.
@lukePeavey, thank you for adding tags to quotes! I'll work on API now.
from quotable.
@lukePeavey, I agree with your suggestions! I'm fully on it π.
from quotable.
I think this would be a great feature! I will work on adding the additional metadata to the quotes, assigning one or more tags to each quote. Here is list of possible tags:
- famous-quotes
- life
- friendship
- science
- technology
- inspirational
- motivational
- literature
- art
- business
- love
- success
- religion
- social-justice
In terms of the API, i think there should be a method to get a complete list of tags (ie /tags
). And then we could add a parameter to the /quotes
method to filter by tag name. Let me know what you think.
from quotable.
Sorry about the long delay. I've been really busy at work lately, so I haven't had much time to work on this.
I am still working on adding tags to all the existing quotes in the database. This is a pretty slow process, since it requires reading through the quotes and coming up with tags for each one (If anyone wants to help with this, let me know).
Anyway, I've added enough tags that we can move ahead with this feature.
from quotable.
I like your suggestion, @lukePeavey! I can start working on it over my holidays.
from quotable.
Sounds good!
from quotable.
Is someone working on adding tags to quotes?
from quotable.
@marekdano Sounds good!
Here is what we have left to do to complete this feature
-
Add a
tags
field to theQuote
schema -
Update
listQuotes
,getQuoteById
, andrandomQuote
to include thetags
field on quotes returned by these endpoints -
Update the relevant tests
-
Add the
tags
parameter torandomQuote
andlistQuote
One possible way to implement the tags
filter would be something this...
if (tags) {
// If a `tags` parameter was provided
if (tags.includes('|')) {
// If `tags` is a pipe separated list (ie "art|music")...
// match quotes that have either of the given tags
filter.tags = { $in: tags.split('|') }
} else {
// If `tags` is a comma separated list or a single tag...
// match quotes that have all of the given tags
filter.tags = { $all: tags.split(',') }
}
}
Let me know what you think
from quotable.
Hi guys,
is any extra help needed for this feature?
happy to contribute.
from quotable.
is any extra help needed for this feature?
The feature is pretty much done. There are a few documentation changes that still need to be made (see issue #25), but thats pretty much it.
from quotable.
@marekdano Great contribution!
from quotable.
Related Issues (20)
- Server is down HOT 1
- API is down HOT 26
- API is down. HOT 1
- API is down HOT 1
- Enhancement : Use Typescript
- Wrong Author
- Node version mentioned in `CONTRIBUTING` and `package.json` are different
- No quotes for tags: athletics and proverb
- API is down HOT 8
- Hamra HOT 1
- API is down HOT 2
- API is down | Invalid Certificate HOT 6
- Tag Name "Work" is duplicate.
- API is down (cert expired) HOT 4
- two quotes have duplicate _id, please solve it. HOT 2
- API is down HOT 1
- Implement Automatic SSL Renewal HOT 3
- API is down HOT 1
- API is down HOT 2
- API is down HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quotable.