<commit_before>package com.bls.patronage.resources;

import com.bls.patronage.api.FlashcardRepresentation;
import com.bls.patronage.db.dao.FlashcardDAO;
import com.bls.patronage.db.model.Flashcard;
import io.dropwizard.jersey.params.UUIDParam;

import javax.validation.Valid;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.UUID;

@Path("/decks/{deckId}/flashcards/{flashcardId}")
@Produces(MediaType.APPLICATION_JSON)
public class FlashcardResource {
    private final FlashcardDAO flashcardDAO;

    public FlashcardResource(FlashcardDAO flashcardDAO) {
        this.flashcardDAO = flashcardDAO;
    }

    @GET
    public Flashcard getFlashcard(
            @Valid @PathParam("flashcardId") UUIDParam flashcardId) {
        return flashcardDAO.getFlashcardById(flashcardId.get());
    }

    @DELETE
    public void deleteFlashcard(
            @Valid @PathParam("flashcardId") UUIDParam flashcardId) {
        flashcardDAO.deleteFlashcard(flashcardDAO.getFlashcardById(flashcardId.get()).getId());
    }

    @PUT
    public Flashcard updateFlashcard(
            @Valid @PathParam("flashcardId") UUID flashcardId,
            @Valid FlashcardRepresentation flashcard,
            @Valid @PathParam("deckId") UUIDParam deckId) {
        Flashcard updatedFlashcard = new Flashcard(flashcardId, flashcard.getQuestion(), flashcard.getAnswer(), deckId.get());
        flashcardDAO.updateFlashcard(updatedFlashcard);
        return updatedFlashcard;
    }
}<commit_msg>Flashcard delete endpoint update, removing code which might cause some trouble<commit_after>package com.bls.patronage.resources;

import com.bls.patronage.api.FlashcardRepresentation;
import com.bls.patronage.db.dao.FlashcardDAO;
import com.bls.patronage.db.model.Flashcard;
import io.dropwizard.jersey.params.UUIDParam;

import javax.validation.Valid;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.UUID;

@Path("/decks/{deckId}/flashcards/{flashcardId}")
@Produces(MediaType.APPLICATION_JSON)
public class FlashcardResource {
    private final FlashcardDAO flashcardDAO;

    public FlashcardResource(FlashcardDAO flashcardDAO) {
        this.flashcardDAO = flashcardDAO;
    }

    @GET
    public Flashcard getFlashcard(
            @Valid @PathParam("flashcardId") UUIDParam flashcardId) {
        return flashcardDAO.getFlashcardById(flashcardId.get());
    }

    @DELETE
    public void deleteFlashcard(
            @Valid @PathParam("flashcardId") UUIDParam flashcardId) {
        flashcardDAO.deleteFlashcard(flashcardId.get());
    }

    @PUT
    public Flashcard updateFlashcard(
            @Valid @PathParam("flashcardId") UUID flashcardId,
            @Valid FlashcardRepresentation flashcard,
            @Valid @PathParam("deckId") UUIDParam deckId) {
        Flashcard updatedFlashcard = new Flashcard(flashcardId, flashcard.getQuestion(), flashcard.getAnswer(), deckId.get());
        flashcardDAO.updateFlashcard(updatedFlashcard);
        return updatedFlashcard;
    }
}
{'fraction_non_alphanumeric': 0.10431873479318735, 'fraction_numerical': 0.0, 'mean_word_length': 4.021374045801527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4047250', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1030, 'n_words': 182}