<commit_before>package backend.model.challenges

import backend.model.event.Team
import backend.model.posting.Posting
import backend.model.sponsoring.UnregisteredSponsor
import backend.model.user.Sponsor
import org.javamoney.moneta.Money
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.data.repository.CrudRepository
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.stereotype.Service
import javax.transaction.Transactional

interface ChallengeService {

    @PreAuthorize("#sponsor.email.equals(authentication.name)")
    fun proposeChallenge(sponsor: Sponsor, team: Team, amount: Money, description: String): Challenge

    @PreAuthorize("#team.isMember(authentication.name)")
    fun proposeChallenge(unregisteredSponsor: UnregisteredSponsor, team: Team, amount: Money, description: String): Challenge

    fun findOne(challengeId: Long): Challenge?

    @PreAuthorize("#team.isMember(authentication.name)")
    fun accept(challenge: Challenge): Challenge

    @PreAuthorize("#team.isMember(authentication.name)")
    fun reject(challenge: Challenge): Challenge

    @PreAuthorize("#team.isMember(authentication.name)")
    fun addProof(challenge: Challenge, proof: Posting): Challenge

    @PreAuthorize("#team.isMember(authentication.name)")
    fun acceptProof(challenge: Challenge): Challenge

    @PreAuthorize("#team.isMember(authentication.name)")<commit_msg>Fix PreAuthorize rules in ChallengeService<commit_after>package backend.model.challenges

import backend.model.event.Team
import backend.model.posting.Posting
import backend.model.sponsoring.UnregisteredSponsor
import backend.model.user.Sponsor
import org.javamoney.moneta.Money
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.data.repository.CrudRepository
import org.springframework.security.access.prepost.PreAuthorize
import org.springframework.stereotype.Service
import javax.transaction.Transactional

interface ChallengeService {

    @PreAuthorize("#sponsor.email.equals(authentication.name)")
    fun proposeChallenge(sponsor: Sponsor, team: Team, amount: Money, description: String): Challenge

    @PreAuthorize("#team.isMember(authentication.name)")
    fun proposeChallenge(unregisteredSponsor: UnregisteredSponsor, team: Team, amount: Money, description: String): Challenge

    fun findOne(challengeId: Long): Challenge?

    @PreAuthorize("#challenge.team.isMember(authentication.name)")
    fun accept(challenge: Challenge): Challenge

    @PreAuthorize("#challenge.team.isMember(authentication.name)")
    fun reject(challenge: Challenge): Challenge

    @PreAuthorize("#challenge.team.isMember(authentication.name)")
    fun addProof(challenge: Challenge, proof: Posting): Challenge

    @PreAuthorize("#challenge.team.isMember(authentication.name)")
    fun acceptProof(challenge: Challenge): Challenge

    @PreAuthorize("#challenge.team.isMember(authentication.name)")
{'fraction_non_alphanumeric': 0.10492792490781093, 'fraction_numerical': 0.0, 'mean_word_length': 6.651282051282052, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1789372', 'n_tokens_mistral': 858, 'n_tokens_neox': 793, 'n_words': 149}