(self, request, *args, **kwargs)
| 163 | raise ValidationError({"github_pk": ["Must be an integer"]}) |
| 164 | |
| 165 | def create(self, request, *args, **kwargs) -> Response | None: # type: ignore[no-untyped-def,return,override] |
| 166 | try: |
| 167 | response: Response = super().create(request, *args, **kwargs) |
| 168 | github_configuration: GithubConfiguration = GithubConfiguration.objects.get( |
| 169 | id=self.kwargs["github_pk"] |
| 170 | ) |
| 171 | if request.data.get("tagging_enabled", False): |
| 172 | create_flagsmith_flag_label( |
| 173 | installation_id=github_configuration.installation_id, |
| 174 | owner=request.data.get("repository_owner"), |
| 175 | repo=request.data.get("repository_name"), |
| 176 | ) |
| 177 | return response |
| 178 | |
| 179 | except IntegrityError as e: |
| 180 | if re.search( |
| 181 | r"Key \(github_configuration_id, project_id, repository_owner, repository_name\)", |
| 182 | str(e), |
| 183 | ) and re.search(r"already exists.$", str(e)): |
| 184 | raise ValidationError( |
| 185 | detail="Duplication error. The GitHub repository already linked" |
| 186 | ) |
| 187 | |
| 188 | def update(self, request, *args, **kwargs) -> Response | None: # type: ignore[no-untyped-def,override] |
| 189 | response: Response = super().update(request, *args, **kwargs) |
no test coverage detected