Skip to content

Commit

Permalink
feat(qgis-map): add description field
Browse files Browse the repository at this point in the history
  • Loading branch information
root authored and root committed Dec 27, 2024
1 parent b85d1c0 commit d2f3f6d
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 0 deletions.
32 changes: 32 additions & 0 deletions symfony/migrations/Version20241227145141.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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 Version20241227145141 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE qgis_map ADD description TEXT DEFAULT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE qgis_map DROP description');
}
}
16 changes: 16 additions & 0 deletions symfony/src/Entity/QgisMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use ApiPlatform\Metadata\Patch;
use ApiPlatform\Metadata\Post;
use App\Repository\QgisMapRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;

Expand Down Expand Up @@ -44,6 +45,9 @@ class QgisMap
#[Groups([self::GET_FULL, self::WRITE])]
private ?QgisProject $qgisProject = null;

#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;

public function getId(): ?int
{
return $this->id;
Expand Down Expand Up @@ -72,4 +76,16 @@ public function setQgisProject(?QgisProject $qgisProject): static

return $this;
}

public function getDescription(): ?string
{
return $this->description;
}

public function setDescription(?string $description): static
{
$this->description = $description;

return $this;
}
}
4 changes: 4 additions & 0 deletions vue/src/assets/translations/fr/qgisMap.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"label": "Nom de la carte QGIS",
"placeholder": "Nom de la carte QGIS"
},
"description": {
"label": "Description",
"placeholder": "Description"
},
"file": {
"label": "Joindre un projet QGIS compressé (.zip)",
"maxSize": "Fichier {maxSize} Mo maximum",
Expand Down
2 changes: 2 additions & 0 deletions vue/src/services/qgisMap/QgisMapFormService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class QgisMapFormService {
// @ts-ignore
const qgisMapSchema: z.ZodType<Partial<QgisMap>> = z.object({
name: z.string().min(1, { message: i18n.t('forms.errorMessages.required') }),
desc: z.string().min(1, { message: i18n.t('forms.errorMessages.required') }),
qgisProject: zodModels.qgisProject
})

Expand All @@ -21,6 +22,7 @@ export class QgisMapFormService {

const form: any = {
name: useField('name'),
desc: useField('desc'),
qgisProject: useField('qgisProject')
}

Expand Down
13 changes: 13 additions & 0 deletions vue/src/views/map/components/QgisMapForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
@blur="form.name.handleChange"
/>
</div>
<div class="Form__fieldCtn">
<label class="Form__label required">{{
$t('qgisMap.form.fields.description.label')
}}</label>
<v-text-field
density="compact"
variant="outlined"
v-model="form.desc.value.value"
:error-messages="form.desc.errorMessage.value"
:placeholder="$t('qgisMap.form.fields.description.label')"
@blur="form.desc.handleChange"
/>
</div>
<div class="Form__fieldCtn">
<label class="Form__label">{{ $t('qgisMap.form.fields.file.label') }}</label>
<FileInput
Expand Down

0 comments on commit d2f3f6d

Please sign in to comment.