Skip to content

Commit

Permalink
Adding user control for workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianFun123 committed Nov 10, 2024
1 parent 3d7e61a commit c02aea2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ public ActionResponse delete(@Path("id") String id, @Attrib("token") AccessToken

domain.delete();

Repo.get(ShortenLink.class).where("domain", domain.id).get().forEach(ShortenLink::delete);
Repo.get(DomainUser.class).where("domain", domain.id).delete();
Repo.get(WorkspaceDomain.class).where("domainId", domain.id).delete();

return new ActionResponse(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import de.interaapps.punyshort.exceptions.PermissionsDeniedException;
import de.interaapps.punyshort.helper.DNSHelper;
import de.interaapps.punyshort.model.database.AccessToken;
import de.interaapps.punyshort.model.database.ShortenLink;
import de.interaapps.punyshort.model.database.User;
import de.interaapps.punyshort.model.database.workspaces.WorkspaceDomain;
import de.interaapps.punyshort.model.database.workspaces.WorkspaceUser;
Expand Down Expand Up @@ -204,4 +205,10 @@ public static Query<Domain> getByWorkspace(String workspaceId, User user) {
public static Query<Domain> getByWorkspace(String workspaceId) {
return getByWorkspace(workspaceId, null);
}

public void delete() {
Repo.get(ShortenLink.class).where("domain", id).get().forEach(ShortenLink::delete);
Repo.get(DomainUser.class).where("domain", id).delete();
Repo.get(WorkspaceDomain.class).where("domainId", id).delete();
}
}

0 comments on commit c02aea2

Please sign in to comment.