Skip to content

Commit

Permalink
Merge pull request #612 from AaronJackson/vendfix
Browse files Browse the repository at this point in the history
Set snackspace product max short_description lengthto 25
  • Loading branch information
dpslwk authored Nov 23, 2024
2 parents 7d22655 + 3910e10 commit e168bfe
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/HMS/Mappings/HMS.Entities.Snackspace.Product.dcm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ HMS\Entities\Snackspace\Product:
nullable: true
shortDescription:
type: string
length: 25
longDescription:
type: text
nullable: true
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Snackspace/ProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function create()
public function store(Request $request)
{
$validatedData = $request->validate([
'shortDescription' => 'required|string|max:255',
'shortDescription' => 'required|string|max:25',
'longDescription' => 'sometimes|nullable|string',
'barcode' => 'sometimes|nullable|string|max:255',
'price' => 'required|integer|min:1',
Expand Down Expand Up @@ -129,7 +129,7 @@ public function edit(Product $product)
public function update(Request $request, Product $product)
{
$validatedData = $request->validate([
'shortDescription' => 'required|string|max:255',
'shortDescription' => 'required|string|max:25',
'longDescription' => 'sometimes|nullable|string',
'barcode' => 'sometimes|nullable|string|max255',
'price' => 'required|integer|min:1',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace Database\Migrations;

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

final class Version20241120222758_alter_snackspace_short_description_max_length extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE products CHANGE short_description short_description VARCHAR(25) NOT NULL');
}

public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE products CHANGE short_description short_description VARCHAR(255) NOT NULL');
}
}

0 comments on commit e168bfe

Please sign in to comment.