Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom color campcollaboration #5281

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
manuelmeister marked this conversation as resolved.
Show resolved Hide resolved
*/
#[InputFilter\Trim]
#[ApiProperty(example: 'AB')]
#[Groups(['read', 'write'])]
#[ORM\Column(type: 'string', length: 2, nullable: true)]
public ?string $abbr = null;
manuelmeister marked this conversation as resolved.
Show resolved Hide resolved

#[ApiProperty(readable: false, writable: false)]
#[ORM\Column(type: 'text', nullable: true)]
public ?string $collaborationAcceptedBy = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed? Is was not used?

Copy link
Member Author

@manuelmeister manuelmeister Jun 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was fully dead code. Unused, and not even tested.

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
Loading