websocket init

This commit is contained in:
2024-03-15 15:44:29 +01:00
parent 11c6d4635f
commit 13c9c8bd3d
15 changed files with 332 additions and 25 deletions

View File

@ -424,6 +424,7 @@ class ScrumController extends AbstractController
{
$em = $this->getDoctrine()->getManager();
$fgcsv = $request->get("fgcsv");
$fgpoker = $request->get("fgpoker");
// Récupérer les repos de gitea
$scrum=$em->getRepository("App:Scrum")->findOneBy(["id"=>$id]);
@ -594,6 +595,7 @@ class ScrumController extends AbstractController
"filterexcludes" => $filterexcludes,
"filterassignees" => $filterassignees,
"showfilters" => $showfilters,
"fgpoker" => $fgpoker,
]);
}

View File

@ -280,4 +280,13 @@ class ScrumissueController extends AbstractController
return new JsonResponse(false);
}
public function getpoker($userid,$issueid,Request $request) {
return new Response(0);
}
public function setpoker($userid,$issueid,Request $request) {
}
}

View File

@ -2,6 +2,8 @@
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
@ -85,6 +87,16 @@ class Scrumissue
*/
private $scrumsprint;
/**
* @ORM\OneToMany(targetEntity="Userpoker", mappedBy="scrumissue", cascade={"persist"}, orphanRemoval=true)
*/
private $userpokers;
public function __construct()
{
$this->userpokers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
@ -234,6 +246,37 @@ class Scrumissue
return $this;
}
/**
* @return Collection|Userpoker[]
*/
public function getUserpokers(): Collection
{
return $this->userpokers;
}
public function addUserpoker(Userpoker $userpoker): self
{
if (!$this->userpokers->contains($userpoker)) {
$this->userpokers[] = $userpoker;
$userpoker->setScrumissue($this);
}
return $this;
}
public function removeUserpoker(Userpoker $userpoker): self
{
if ($this->userpokers->contains($userpoker)) {
$this->userpokers->removeElement($userpoker);
// set the owning side to null (unless already changed)
if ($userpoker->getScrumissue() === $this) {
$userpoker->setScrumissue(null);
}
}
return $this;
}
}

View File

@ -85,6 +85,11 @@ class User implements UserInterface, \Serializable
*/
private $preference;
/**
* @ORM\OneToMany(targetEntity="Userpoker", mappedBy="user", cascade={"persist"}, orphanRemoval=true)
*/
private $userpokers;
/**
* @ORM\ManyToMany(targetEntity="Group", inversedBy="users", cascade={"persist"})
* @ORM\JoinTable(name="usergroupe",
@ -107,6 +112,7 @@ class User implements UserInterface, \Serializable
{
$this->groups = new ArrayCollection();
$this->scrums = new ArrayCollection();
$this->userpokers = new ArrayCollection();
}
public function getUsername(): ?string
@ -172,7 +178,7 @@ class User implements UserInterface, \Serializable
public function getDisplayname()
{
return $this->firstname." ".$this->lastname;
return $this->username;
}
public function setId(int $id): self
@ -336,4 +342,35 @@ class User implements UserInterface, \Serializable
return $this;
}
/**
* @return Collection|Userpoker[]
*/
public function getUserpokers(): Collection
{
return $this->userpokers;
}
public function addUserpoker(Userpoker $userpoker): self
{
if (!$this->userpokers->contains($userpoker)) {
$this->userpokers[] = $userpoker;
$userpoker->setUser($this);
}
return $this;
}
public function removeUserpoker(Userpoker $userpoker): self
{
if ($this->userpokers->contains($userpoker)) {
$this->userpokers->removeElement($userpoker);
// set the owning side to null (unless already changed)
if ($userpoker->getUser() === $this) {
$userpoker->setUser(null);
}
}
return $this;
}
}

82
src/Entity/Userpoker.php Normal file
View File

@ -0,0 +1,82 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* Userpoker
*
* @ORM\Entity()
* @ORM\Table(name="userpoker")
*/
class Userpoker
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(name="name", type="integer")
*
*/
private $nb;
/**
* @ORM\ManyToOne(targetEntity="Scrumissue", inversedBy="userpokers")
*/
private $scrumissue;
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="userpokers")
*/
private $user;
public function getId(): ?int
{
return $this->id;
}
public function getNb(): ?int
{
return $this->nb;
}
public function setNb(int $nb): self
{
$this->nb = $nb;
return $this;
}
public function getScrumissue(): ?Scrumissue
{
return $this->scrumissue;
}
public function setScrumissue(?Scrumissue $scrumissue): self
{
$this->scrumissue = $scrumissue;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
}

View File

@ -265,6 +265,14 @@ class ScrumRepository extends ServiceEntityRepository
}
$scrumissue->setGiteajson(json_decode(json_encode($giteaissue), true));
// Si le ticket est lié à un sprint on s'assure que ce sprint est bien lié au milestone du ticket
if($scrumissue->getScrumsprint()) {
if($scrumissue->getScrumsprint()->getGiteamilestone()!=$scrumissue->getGiteamilestone()) {
$scrumissue->setScrumsprint(null);
}
}
$this->_em->persist($scrumissue);
$this->_em->flush();