Skip to content

Commit

Permalink
Add custom color & abbr on CampCollaboration
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelmeister committed Jun 16, 2024
1 parent 22b9a5c commit 555f40b
Show file tree
Hide file tree
Showing 16 changed files with 316 additions and 5 deletions.
27 changes: 27 additions & 0 deletions api/migrations/schema/Version20240507154923.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240507154923 extends AbstractMigration {
public function getDescription(): string {
return 'Add color and abbr to camp_collaboration';
}

public function up(Schema $schema): void {
$this->addSql('ALTER TABLE camp_collaboration ADD color VARCHAR(8) DEFAULT NULL');
$this->addSql('ALTER TABLE camp_collaboration ADD abbr VARCHAR(2) DEFAULT NULL');
}

public function down(Schema $schema): void {
$this->addSql('ALTER TABLE camp_collaboration DROP color');
$this->addSql('ALTER TABLE camp_collaboration DROP abbr');
}
}
19 changes: 19 additions & 0 deletions api/src/Entity/CampCollaboration.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,25 @@ class CampCollaboration extends BaseEntity implements BelongsToCampInterface {
#[ORM\Column(type: 'string', length: 16, nullable: false)]
public string $role;

/**
* The color of the avatar as a hex color string.
*/
#[InputFilter\Trim]
#[Assert\Regex(pattern: '/^#[0-9a-zA-Z]{6}$/')]
#[ApiProperty(example: '#4DBB52')]
#[Groups(['read', 'write'])]
#[ORM\Column(type: 'string', length: 8, nullable: true)]
public ?string $color = null;

/**
* The abbreviation in th avatar.
*/
#[InputFilter\Trim]
#[ApiProperty(example: 'AB')]
#[Groups(['read', 'write'])]
#[ORM\Column(type: 'string', length: 2, nullable: true)]
public ?string $abbr = null;

#[ApiProperty(readable: false, writable: false)]
#[ORM\Column(type: 'text', nullable: true)]
public ?string $collaborationAcceptedBy = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
},
"user": "escaped_value"
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -139,6 +141,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -217,6 +221,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -295,6 +301,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -373,6 +381,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -451,6 +461,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -529,6 +541,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -607,6 +621,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -685,6 +701,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -763,6 +781,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -841,6 +861,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -919,6 +941,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
},
"user": "escaped_value"
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -45,6 +47,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -76,6 +80,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -107,6 +113,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -138,6 +146,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down Expand Up @@ -169,6 +179,8 @@
"href": "escaped_value"
}
},
"abbr": "escaped_value",
"color": "escaped_value",
"id": "escaped_value",
"inviteEmail": "escaped_value",
"role": "escaped_value",
Expand Down
Loading

0 comments on commit 555f40b

Please sign in to comment.