Implementing a New GraphQL Query or Mutation
Steps in order:
- Schema — add query/mutation to
queries.graphqlsormutations.graphqls; define types in per-entity.graphqls; addInputtypes as needed - DTO — create
EntityDto.javaandEntityInput.javainweb/dto/; fields must match schema - Mapper — create
EntityMapper.javaextendingBaseMapper<Entity, EntityDto, EntityInput>; add@AfterMappingfor bidirectional references - Controller — add
@QueryMapping/@MutationMappingmethod; resolvecurrentUserIdhere and pass to service; add@PreAuthorize - Service — add business logic; accept
currentUserIdas method parameter; use repositories - Repository — extend
BaseRepository<Entity>; for workspace subclass fields, query the subclass - Permissions — read endpoints use membership checks; write endpoints use permission matrix checks; add OWNER membership for creators
- Validate — run
./mvnw compile; no tests needed
DB: Liquibase is active. Add a new numbered SQL changelog file under src/main/resources/db/changelog/ (e.g. 0006-add-my-table.sql) and include it in db.changelog-master.yaml. Use --liquibase formatted sql header and --changeset author:id tag. JPA ddl-auto is still set to update as a safety net but Liquibase controls the schema.