Giter Site home page Giter Site logo

Comments (14)

lukePeavey avatar lukePeavey commented on July 17, 2024 3

πŸš€Just deployed the latest changes, this should be live now :)

from quotable.

marekdano avatar marekdano commented on July 17, 2024 1

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.

lukePeavey avatar lukePeavey commented on July 17, 2024 1

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.

marekdano avatar marekdano commented on July 17, 2024 1

@lukePeavey, thank you for adding tags to quotes! I'll work on API now.

from quotable.

marekdano avatar marekdano commented on July 17, 2024 1

@lukePeavey, I agree with your suggestions! I'm fully on it πŸ˜„.

from quotable.

lukePeavey avatar lukePeavey commented on July 17, 2024

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.

lukePeavey avatar lukePeavey commented on July 17, 2024

@marekdano

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.

marekdano avatar marekdano commented on July 17, 2024

I like your suggestion, @lukePeavey! I can start working on it over my holidays.

from quotable.

lukePeavey avatar lukePeavey commented on July 17, 2024

Sounds good!

from quotable.

marekdano avatar marekdano commented on July 17, 2024

Is someone working on adding tags to quotes?

from quotable.

lukePeavey avatar lukePeavey commented on July 17, 2024

@marekdano Sounds good!

Here is what we have left to do to complete this feature

  • Add a tags field to the Quote schema

  • Update listQuotes, getQuoteById, and randomQuote to include the tags field on quotes returned by these endpoints

  • Update the relevant tests

  • Add the tags parameter to randomQuote and listQuote

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.

nonotest avatar nonotest commented on July 17, 2024

Hi guys,

is any extra help needed for this feature?

happy to contribute.

from quotable.

lukePeavey avatar lukePeavey commented on July 17, 2024

@nonotest

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.

lukePeavey avatar lukePeavey commented on July 17, 2024

@marekdano Great contribution!

from quotable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.