This commit is contained in:
2026-06-02 15:42:21 -06:00
parent d0675a6aeb
commit a9bb7423ca
5 changed files with 0 additions and 30 deletions

View File

@@ -9,8 +9,6 @@ import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size; 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 title optional note title, limited to a concise display length
* @param content required note body * @param content required note body
*/ */

View File

@@ -9,8 +9,6 @@ import java.time.Instant;
import java.util.UUID; import java.util.UUID;
/** /**
* Represents a note visible to the authenticated caller.
*
* @param id stable note identifier * @param id stable note identifier
* @param title note title * @param title note title
* @param content note body * @param content note body

View File

@@ -9,8 +9,6 @@ import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size; import jakarta.validation.constraints.Size;
/** /**
* Carries the target username for a note share operation.
*
* @param username recipient username to grant read-only access * @param username recipient username to grant read-only access
*/ */
public record ShareNoteRequest( public record ShareNoteRequest(

View File

@@ -1,9 +1,5 @@
/** /**
* NoteShareRepository.java * 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; package com.seanstarkey.notesvault.repository;
@@ -16,15 +12,9 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.UUID; 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> { public interface NoteShareRepository extends JpaRepository<NoteShare, UUID> {
/** /**
* Finds an existing share grant for a note and recipient user.
*
* @param note the shared note * @param note the shared note
* @param sharedWith the user who may have read-only access * @param sharedWith the user who may have read-only access
* @return an Optional containing the share grant, or empty when no grant exists * @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); 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 note the note whose share grants should be searched
* @param sharedWith the recipient user * @param sharedWith the recipient user
* @return true when a share grant exists; false otherwise * @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); boolean existsByNoteAndSharedWith(Note note, User sharedWith);
/** /**
* Lists all share grants for a note.
*
* @param note the note whose share grants should be returned * @param note the note whose share grants should be returned
* @return all share grants associated with the note * @return all share grants associated with the note
*/ */
List<NoteShare> findAllByNote(Note note); List<NoteShare> findAllByNote(Note note);
/** /**
* Lists all share grants received by a user.
*
* @param sharedWith the user whose received shares should be returned * @param sharedWith the user whose received shares should be returned
* @return all share grants where the supplied user is the recipient * @return all share grants where the supplied user is the recipient
*/ */
List<NoteShare> findAllBySharedWith(User sharedWith); List<NoteShare> findAllBySharedWith(User sharedWith);
/** /**
* Deletes all share grants for a note.
*
* @param note the note whose share grants should be removed * @param note the note whose share grants should be removed
*/ */
void deleteAllByNote(Note note); void deleteAllByNote(Note note);

View File

@@ -1,7 +1,5 @@
/** /**
* NoteListingControllerTest.java * NoteListingControllerTest.java
*
* API-level tests for authenticated note listing behavior.
*/ */
package com.seanstarkey.notesvault.controller; 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.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; 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 @SpringBootTest
@AutoConfigureMockMvc @AutoConfigureMockMvc
@Transactional @Transactional