generated from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #211 from Arquisoft/admin-view
Admin view
- Loading branch information
Showing
46 changed files
with
1,143 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
package com.uniovi.repositories; | ||
|
||
import com.uniovi.entities.Player; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface PlayerRepository extends CrudRepository<Player, Long> { | ||
Player findByEmail(String email); | ||
Player findByUsername(String nickname); | ||
|
||
Page<Player> findAll(Pageable pageable); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,12 +41,15 @@ public InsertSampleDataService(PlayerService playerService, QuestionService ques | |
@Transactional | ||
@EventListener(ApplicationReadyEvent.class) // Uncomment this line to insert sample data on startup | ||
public void insertSampleQuestions() throws InterruptedException, IOException { | ||
if (!playerService.getUserByEmail("[email protected]").isPresent()) { | ||
if (playerService.getUserByEmail("[email protected]").isEmpty()) { | ||
PlayerDto player = new PlayerDto(); | ||
player.setEmail("[email protected]"); | ||
player.setUsername("test"); | ||
player.setPassword("test"); | ||
player.setRoles(new String[]{"ROLE_USER"}); | ||
if (Arrays.asList(environment.getActiveProfiles()).contains("test")) | ||
player.setRoles(new String[]{"ROLE_USER", "ROLE_ADMIN"}); | ||
else | ||
player.setRoles(new String[]{"ROLE_USER"}); | ||
playerService.generateApiKey(playerService.addNewPlayer(player)); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.