Cleanup
This commit is contained in:
@@ -9,8 +9,6 @@ import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* Carries note content supplied by an authenticated owner.
|
||||
*
|
||||
* @param title optional note title, limited to a concise display length
|
||||
* @param content required note body
|
||||
*/
|
||||
|
||||
@@ -9,8 +9,6 @@ import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Represents a note visible to the authenticated caller.
|
||||
*
|
||||
* @param id stable note identifier
|
||||
* @param title note title
|
||||
* @param content note body
|
||||
|
||||
@@ -9,8 +9,6 @@ import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* Carries the target username for a note share operation.
|
||||
*
|
||||
* @param username recipient username to grant read-only access
|
||||
*/
|
||||
public record ShareNoteRequest(
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
/**
|
||||
* NoteShareRepository.java
|
||||
*
|
||||
* Spring Data repository for note share grants. Provides lookup helpers for
|
||||
* duplicate-share checks, read-access checks, and data-layer tests around cascade
|
||||
* deletion behavior.
|
||||
*/
|
||||
package com.seanstarkey.notesvault.repository;
|
||||
|
||||
@@ -16,15 +12,9 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Repository for NoteShare entities. Encapsulates queries around read-only share
|
||||
* grants between notes and recipient users.
|
||||
*/
|
||||
public interface NoteShareRepository extends JpaRepository<NoteShare, UUID> {
|
||||
|
||||
/**
|
||||
* Finds an existing share grant for a note and recipient user.
|
||||
*
|
||||
* @param note the shared note
|
||||
* @param sharedWith the user who may have read-only access
|
||||
* @return an Optional containing the share grant, or empty when no grant exists
|
||||
@@ -32,8 +22,6 @@ public interface NoteShareRepository extends JpaRepository<NoteShare, UUID> {
|
||||
Optional<NoteShare> findByNoteAndSharedWith(Note note, User sharedWith);
|
||||
|
||||
/**
|
||||
* Checks whether a note is already shared with a recipient.
|
||||
*
|
||||
* @param note the note whose share grants should be searched
|
||||
* @param sharedWith the recipient user
|
||||
* @return true when a share grant exists; false otherwise
|
||||
@@ -41,24 +29,18 @@ public interface NoteShareRepository extends JpaRepository<NoteShare, UUID> {
|
||||
boolean existsByNoteAndSharedWith(Note note, User sharedWith);
|
||||
|
||||
/**
|
||||
* Lists all share grants for a note.
|
||||
*
|
||||
* @param note the note whose share grants should be returned
|
||||
* @return all share grants associated with the note
|
||||
*/
|
||||
List<NoteShare> findAllByNote(Note note);
|
||||
|
||||
/**
|
||||
* Lists all share grants received by a user.
|
||||
*
|
||||
* @param sharedWith the user whose received shares should be returned
|
||||
* @return all share grants where the supplied user is the recipient
|
||||
*/
|
||||
List<NoteShare> findAllBySharedWith(User sharedWith);
|
||||
|
||||
/**
|
||||
* Deletes all share grants for a note.
|
||||
*
|
||||
* @param note the note whose share grants should be removed
|
||||
*/
|
||||
void deleteAllByNote(Note note);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/**
|
||||
* NoteListingControllerTest.java
|
||||
*
|
||||
* API-level tests for authenticated note listing behavior.
|
||||
*/
|
||||
package com.seanstarkey.notesvault.controller;
|
||||
|
||||
@@ -18,10 +16,6 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
/**
|
||||
* Verifies GET /notes through the real Spring MVC, Security, JPA, validation,
|
||||
* and Flyway-backed H2 application stack.
|
||||
*/
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
@Transactional
|
||||
|
||||
Reference in New Issue
Block a user