coding-blocks/gondor

[Events] Add Slug to CalendarEvent

Closed this issue ยท 19 comments

  1. Write a migration to add slug string column to calendar_events table which can be null.
  2. Update the sequelize model accordingly
  3. Update CalendarEvent graphql type
  4. Update the AuthorizationPolicy to allow update of the column to organizer and admins and allow read to everyone.
  5. Update CalendarEventCreate mutation to auto generate slug from the event title using slugify.
  6. Update CalendarEventUpdate mutation to support slug update.
  7. Integrate the new column in the view and edit event modals. In the edit modal show an input field below description to edit the slug. The input value should be initialized by the slug of the event.
  8. In the view modal, add the slug text at the top linking to /events/<slug>.

Please maintain the code quality and naming conventions.

Thanks @hereisnaman, for raising the issue! ๐Ÿ™Œ

One of our mentors will revert on this soon. โœ…

Star โญ this project and tweet ๐Ÿฆ about BOSS 2020.

i would like to work on this

i would like to work on this

go ahead. Review from this PR should help #73.

Just wanted to ask that when title can't be null then how can slug be null

Just wanted to ask that when title can't be null then how can slug be null

Was planning to break it into few steps. But yeah sure go ahead and make slug not null. Lets see how you solve it. :)

Am i correct?
we should not take input for slug in create but in update we should take

Am i correct?
we should not take input for slug in create but in update we should take

Slug is auto generated, but if someone wants to edit it afterwards, that should be allowed.

Can i have a look into this? I guess i have some experience related to it ๐Ÿ˜„

Although for the slug we should replace spaces with '_' from the title right?

Although for the slug we should replace spaces with '_' from the title right?

Sure you can try. use the slugify package to do that work for you.

What i was asking is should i replace spaces with '-' or '_' in the title from slugify. What is preferable?

What i was asking is should i replace spaces with '-' or '_' in the title from slugify. What is preferable?

-

On running migrations through cli, i am getting an error "ERROR: column "slug" contains null values",
any help to resolve it.

@coderrsid you have done this while creating a column for is_open, How did you resolve this, Do the migrations need some extra work??

You can see in my pull request how i implemented it.

Thanks but i am asking that whether you encountered the same error while doing migrations (sequelize db:migrate) if so can you please tell me how you handled it?

On running migrations through cli, i am getting an error "ERROR: column "slug" contains null values",
any help to resolve it.

Yeah so now answer me how can you make the slug column not null when there are already eateries in the database where there is no slug?

Find the solution.

Oh... So, After migrations changing slug back to "allow null: false" would work i think

Oh... So, After migrations changing slug back to "allow null: false" would work i think

But before that, you will need to write a migration which will generate slug for all the present entities in db.

You can do all these 3 steps in a single migration.