Skip to content

Conversation

sirQuail
Copy link
Contributor

Created a file with hooks similar to the ones found in strike-queries. The hooks were tested and there seems to be no issues with their functionality.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds test-related query hooks for trainee management functionality. The hooks provide comprehensive CRUD operations for test management within the trainee system, following similar patterns from the existing strike-queries implementation.

Key changes:

  • Added complete test management hooks (add, get, edit, delete) with proper error handling
  • Implemented test sorting by date in descending order
  • Added proper TypeScript typing and JSDoc documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

/**
* Hook to get the tests of a trainee.
* @param {string} traineeId the id of the trainee to get the tests from.
* @returns {UseQueryResult<Strike[], Error>} the tests of the trainee.
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return type annotation incorrectly references 'Strike[]' instead of 'Test[]'. This should be updated to match the actual return type.

Suggested change
* @returns {UseQueryResult<Strike[], Error>} the tests of the trainee.
* @returns {UseQueryResult<Test[], Error>} the tests of the trainee.

Copilot uses AI. Check for mistakes.

},
{
select: ({ data }) => {
return orderTestsByDateDesc(data as Test[]);
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type assertion 'as Test[]' is unnecessary since the axios.get<Test[]> call already ensures the correct type. Consider removing the type assertion for cleaner code.

Suggested change
return orderTestsByDateDesc(data as Test[]);
return orderTestsByDateDesc(data);

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants