Opened 5 years ago

Closed 3 years ago

#8 closed enhancement (fixed)

Allow deletion of bookmarks

Reported by: peter Owned by: peter
Priority: critical Component: codebase
Keywords: Cc:
Project: BookmarksApp

Description

Allow deletion of bookmarks. Deleted bookmarks should retain a tombstone at their old URI, which responds with a 410 Gone response. This response must be marked as cacheable.

Change History (4)

comment:1 Changed 4 years ago by peter

  • Priority changed from major to critical

comment:2 Changed 4 years ago by peter

One solution might be along the lines of

sub delete {
    my $self = shift;
    my $bookmark = shift;

    my $sth_insert = $self->dbh->prepare(
        'insert into deleted_bookmarks (id, dtime) values (?, ?)'
    );
    $sth_insert->execute($bookmark->id, time);
    
    my $sth_delete = $self->dbh->prepare(
        'delete from bookmarks where id = ?'
    );
    $sth_delete->execute($bookmark->id);
}

The issue with the above is that the id in the bookmark table will get re-used. The proper way to do this will be to have a single bookmark_id table that just exists to track the ids of bookmarks that are ever used. Then the bookmarks and deleted_bookmarks tables would both reference that table via a foreign key on their id primary key column.

This will require some changes to how bookmarks are created. In particular, the system needs to check for the existence of bookmarks before creating them, rather than just waiting for exceptions. Which is good programming practice anyway.

Last edited 4 years ago by peter (previous) (diff)

comment:3 Changed 3 years ago by peter

Main implementation complete (in the Git repo). Not going to expend more effort on making the 410 Gone response cacheable unless there is a demonstrated need later.

comment:4 Changed 3 years ago by peter

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.