mbos2 / url-shortener

Simple, Selfhosted, URLShortener service
MIT License
8 stars 3 forks source link

Delete ShortUrls #10

Closed GuyKh closed 1 year ago

GuyKh commented 1 year ago

Solves #3

GuyKh commented 1 year ago

@mbos2 - I can't test it, but I think it's done

mbos2 commented 1 year ago

Hey @GuyKh

I see you're adding shortUrlFull to the query and then parsing it to get the code in the backend. There's no need to do that.

You can send shortUrl from the frontend, because it's present in the data. shortUrl is only the code. Here's how it's in the database

image

Could you make those small adjustments so you use shortUrl instead shortUrlFull and then extracting the code from that?

This is the data object example for every item you get when generating table in the UI

{
    "shortUrl": "lt3kil",
    "url": "https://quangpro1610.github.io/w3school-october-event-halloween-responsive-website",
    "shortUrlFull": "https://6515fbdc6a7b8aa04c45.appwrite.global/lt3kil",
    "createdAt": 1696163434886,
    "alias": "asdas",
    "$databaseId": "short_url_database",
    "$collectionId": "short_url_collection"
}

image

So here it would be item.shortUrl that you should add for the delete functionaliy

GuyKh commented 1 year ago

@mbos2 done, in the backend I still would keep the "clearing" of the domain because of decoupling both; As the API theoretically can support both

mbos2 commented 1 year ago

@GuyKh image This will probably have to be changed cause it causes some frontend hickup I believe, but no worries about it, I'll make a change on it.

Thanks for the contribution :)