AutoCRUD is a Spring Boot-based REST API that automatically generates and manages CRUD operations for custom data structures defined by users. It allows users to define custom fields, channels, and entries, and easily manage authentication and ownership checks for secure data manipulation.
Allows users to log in and retrieve a token for subsequent requests.
- Request Body:
LoginRequestDTO
containingemail
andpassword
. - Response:
LoginResponseDTO
containing an authentication token.
Creates a new user with the specified email, password, and optional roles.
- Parameters:
email
(required): The email address of the user.password
(required): The password for the user.roles
(optional): A list of roles for the user. Defaults toROLE_USER
if not provided.
Creates a new channel based on the given information.
- Request Body:
ChannelDTO
containing channel details. - Response:
ChannelDTO
representing the created channel.
Fetches the details of a channel by its ID.
- Authorization: Ownership validation is performed.
- Response:
ChannelDTO
containing channel details.
Updates an existing channel by ID.
- Authorization: Ownership validation is performed.
- Request Body: Updated
ChannelDTO
details. - Response: Updated
ChannelDTO
.
Deletes a channel by its ID.
- Authorization: Ownership validation is performed.
- Response: Deleted
ChannelDTO
.
Adds entries linked to a channel.
- Request Body: List of
EntryDTO
representing the entries to be added. - Response: List of created
EntryDTO
.
Fetches an entry by its ID.
- Authorization: Ownership validation is performed.
- Response:
EntryDTO
containing entry details.
Updates an entry by ID.
- Authorization: Ownership validation is performed.
- Request Body: Updated
EntryDTO
details. - Response: Updated
EntryDTO
.
Deletes an entry by its ID.
- Authorization: Ownership validation is performed.
Fetches details of a field by its ID.
- Authorization: Ownership validation is performed.
- Response:
FieldDTO
containing field details.
Updates an existing field by its ID.
- Authorization: Ownership validation is performed.
- Request Body: Updated
FieldDTO
details. - Response: Updated
FieldDTO
.
- Java 21 or newer
- Maven
- MySQL database (can be configured through environment variables)
- Clone the repository.
- Set up a MySQL database and update the database URL, username, and password in
application.properties
or use environment variables (DB_URL
,DB_USERNAME
,DB_PASSWORD
). - Run the application using Maven:
mvn spring-boot:run
To run the tests, use the following command:
mvn test
DB_URL
: URL of the MySQL database (default:jdbc:mysql://localhost:3306/autocrud
).DB_USERNAME
: Username for the database (default:root
).DB_PASSWORD
: Password for the database (default:root
).
- Authentication is required for most endpoints.
- Ownership validation (
@CheckOwnership
) ensures that users can only access or modify resources they own.
- Java 21
- Spring Boot (including Spring Security)
- Maven for dependency management
- MySQL for data storage