Skip to content

Commit

Permalink
PS-634 baskets (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
4rthem authored Apr 8, 2024
1 parent 729630f commit d13e79b
Show file tree
Hide file tree
Showing 208 changed files with 8,711 additions and 8,224 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,19 +234,22 @@ jobs:
- name: Pull images
run: |
docker compose pull
docker compose pull configurator
- name: Setup
if: "!contains(github.event.head_commit.message, '[skip test]')"
run: |
docker compose down --volumes
bin/dev/make-cert.sh
sudo PHRASEA_DOMAIN=${PHRASEA_DOMAIN} bin/dev/append-etc-hosts.sh
bin/setup.sh test
- name: Test
if: "!contains(github.event.head_commit.message, '[skip test]')"
run: bin/test.sh

- name: Run Cypress tests
if: "!contains(github.event.head_commit.message, '[skip cypress]')"
if: "!contains(github.event.head_commit.message, '[skip cypress]') && !contains(github.event.head_commit.message, '[skip test]')"
run: |
docker compose up -d
docker compose run --rm cypress
Expand Down
30 changes: 15 additions & 15 deletions dashboard/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@
"@alchemy/api": "workspace:*",
"@alchemy/auth": "workspace:*",
"@alchemy/core": "workspace:*",
"@alchemy/phrasea-ui": "workspace:*",
"@alchemy/react-auth": "workspace:*",
"@alchemy/theme-editor": "workspace:*",
"@alchemy/phrasea-ui": "workspace:*",
"@mui/material": "^5.15.1",
"@mui/icons-material": "^5.15.0",
"@mui/icons-material": "^5.15.13",
"@mui/material": "^5.15.13",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-google-font-loader": "^1.1.0",
"vite-plugin-svgr": "^4.2.0",
"react-i18next": "^13.5.0"
"react-i18next": "^13.5.0",
"vite-plugin-svgr": "^4.2.0"
},
"devDependencies": {
"@types/node": "^18.8.5",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"eslint": "^8.53.0",
"typescript": "^5.2.2",
"vite": "^5.0.0",
"vite-plugin-checker": "^0.6.2",
"@types/node": "^18.19.24",
"@types/react": "^18.2.65",
"@types/react-dom": "^18.2.22",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitejs/plugin-react-swc": "^3.6.0",
"eslint": "^8.57.0",
"typescript": "^5.4.2",
"vite": "^5.1.6",
"vite-plugin-checker": "^0.6.4",
"vite-plugin-svgr": "^4.2.0"
}
}
1 change: 1 addition & 0 deletions databox/api/config/packages/alchemy_acl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ alchemy_acl:
workspace: App\Entity\Core\Workspace
attribute_class: App\Entity\Core\AttributeClass
data_template: App\Entity\Template\AssetDataTemplate
basket: App\Entity\Basket\Basket
32 changes: 32 additions & 0 deletions databox/api/config/packages/fos_elastica.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,38 @@ fos_elastica:
provider:
query_builder_method: getESQueryBuilder

basket:
settings:
index:
analysis:
analyzer:
text: *text_analyzer
filter:
worddelimiter: *worddelimiter_filter
use_alias: '%elastica.use_alias%'
index_name: "%es_index_prefix%basket_%kernel.environment%"
properties:
title:
type: text
analyzer: text
description:
type: text
analyzer: text
ownerId:
type: keyword
users:
property_path: false
type: keyword
groups:
property_path: false
type: keyword
persistence:
driver: orm
model: App\Entity\Basket\Basket
listener: { enabled: false }
provider:
query_builder_method: getESQueryBuilder

when@dev:
parameters:
elastica.use_alias: false
Expand Down
20 changes: 1 addition & 19 deletions databox/api/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
string $databoxBaseUrl: '%env(DATABOX_API_URL)%'
string $databoxClientBaseUrl: '%env(DATABOX_CLIENT_URL)%'
ApiPlatform\State\ProviderInterface $itemProvider: '@api_platform.doctrine.orm.state.item_provider'
ApiPlatform\State\ProviderInterface $itemsProvider: '@api_platform.doctrine.orm.state.collection_provider'
ApiPlatform\State\ProviderInterface $collectionProvider: '@api_platform.doctrine.orm.state.collection_provider'
bool $useAlias: '%elastica.use_alias%'
string $kernelEnv: '%kernel.environment%'

Expand Down Expand Up @@ -57,24 +57,6 @@ services:
resource: '../src/Controller/'
tags: ['controller.service_arguments']

App\Elasticsearch\AssetSearch:
arguments:
$finder: '@fos_elastica.finder.asset'

App\Elasticsearch\SuggestionSearch:
arguments:
$collectionIndex: '@fos_elastica.index.collection'
$assetIndex: '@fos_elastica.index.asset'
$attributeIndex: '@fos_elastica.index.attribute'

App\Elasticsearch\CollectionSearch:
arguments:
- '@fos_elastica.finder.collection'

App\Elasticsearch\AssetDataTemplateSearch:
arguments:
- '@fos_elastica.finder.asset_data_template'

App\Api\Serializer\SecurityContextBuilder:
decorates: 'api_platform.serializer.context_builder'
arguments: [ '@App\Api\Serializer\SecurityContextBuilder.inner' ]
Expand Down
30 changes: 30 additions & 0 deletions databox/api/migrations/Version20240313095604.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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 Version20240313095604 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 workspace ALTER owner_id TYPE VARCHAR(36)');
}

public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE workspace ALTER owner_id TYPE VARCHAR(255)');
}
}
69 changes: 69 additions & 0 deletions databox/api/migrations/Version20240313110345.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?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 Version20240313110345 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('CREATE TABLE basket_basket_asset (basket_id UUID NOT NULL, basket_asset_id UUID NOT NULL, PRIMARY KEY(basket_id, basket_asset_id))');
$this->addSql('CREATE INDEX IDX_1A9FEAA51BE1FB52 ON basket_basket_asset (basket_id)');
$this->addSql('CREATE INDEX IDX_1A9FEAA561751691 ON basket_basket_asset (basket_asset_id)');
$this->addSql('COMMENT ON COLUMN basket_basket_asset.basket_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN basket_basket_asset.basket_asset_id IS \'(DC2Type:uuid)\'');
$this->addSql('CREATE TABLE basket_asset (id UUID NOT NULL, basket_id UUID NOT NULL, asset_id UUID NOT NULL, owner_id VARCHAR(36) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_54D711661BE1FB52 ON basket_asset (basket_id)');
$this->addSql('CREATE INDEX IDX_54D711665DA1941 ON basket_asset (asset_id)');
$this->addSql('COMMENT ON COLUMN basket_asset.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN basket_asset.basket_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN basket_asset.asset_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN basket_asset.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE basket_basket_asset ADD CONSTRAINT FK_1A9FEAA51BE1FB52 FOREIGN KEY (basket_id) REFERENCES basket (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE basket_basket_asset ADD CONSTRAINT FK_1A9FEAA561751691 FOREIGN KEY (basket_asset_id) REFERENCES basket_asset (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE basket_asset ADD CONSTRAINT FK_54D711661BE1FB52 FOREIGN KEY (basket_id) REFERENCES basket (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE basket_asset ADD CONSTRAINT FK_54D711665DA1941 FOREIGN KEY (asset_id) REFERENCES asset (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE basket DROP CONSTRAINT fk_2246507b514956fd');
$this->addSql('DROP INDEX idx_2246507b514956fd');
$this->addSql('ALTER TABLE basket ADD title VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE basket ADD owner_id VARCHAR(36) NOT NULL');
$this->addSql('ALTER TABLE basket ADD created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL');
$this->addSql('ALTER TABLE basket ADD updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL');
$this->addSql('ALTER TABLE basket DROP collection_id');
$this->addSql('COMMENT ON COLUMN basket.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN basket.updated_at IS \'(DC2Type:datetime_immutable)\'');
}

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 basket_basket_asset DROP CONSTRAINT FK_1A9FEAA51BE1FB52');
$this->addSql('ALTER TABLE basket_basket_asset DROP CONSTRAINT FK_1A9FEAA561751691');
$this->addSql('ALTER TABLE basket_asset DROP CONSTRAINT FK_54D711661BE1FB52');
$this->addSql('ALTER TABLE basket_asset DROP CONSTRAINT FK_54D711665DA1941');
$this->addSql('DROP TABLE basket_basket_asset');
$this->addSql('DROP TABLE basket_asset');
$this->addSql('ALTER TABLE basket ADD collection_id UUID NOT NULL');
$this->addSql('ALTER TABLE basket DROP title');
$this->addSql('ALTER TABLE basket DROP owner_id');
$this->addSql('ALTER TABLE basket DROP created_at');
$this->addSql('ALTER TABLE basket DROP updated_at');
$this->addSql('COMMENT ON COLUMN basket.collection_id IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE basket ADD CONSTRAINT fk_2246507b514956fd FOREIGN KEY (collection_id) REFERENCES collection (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_2246507b514956fd ON basket (collection_id)');
}
}
32 changes: 32 additions & 0 deletions databox/api/migrations/Version20240314092227.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 Version20240314092227 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 basket_asset ADD context JSON 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 basket_asset DROP context');
}
}
44 changes: 44 additions & 0 deletions databox/api/migrations/Version20240326173512.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?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 Version20240326173512 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 basket_basket_asset DROP CONSTRAINT fk_1a9feaa51be1fb52');
$this->addSql('ALTER TABLE basket_basket_asset DROP CONSTRAINT fk_1a9feaa561751691');
$this->addSql('DROP TABLE basket_basket_asset');
$this->addSql('ALTER TABLE basket ADD description TEXT DEFAULT NULL');
$this->addSql('ALTER TABLE basket_asset ADD position BIGINT DEFAULT 0 NOT 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('CREATE TABLE basket_basket_asset (basket_id UUID NOT NULL, basket_asset_id UUID NOT NULL, PRIMARY KEY(basket_id, basket_asset_id))');
$this->addSql('CREATE INDEX idx_1a9feaa561751691 ON basket_basket_asset (basket_asset_id)');
$this->addSql('CREATE INDEX idx_1a9feaa51be1fb52 ON basket_basket_asset (basket_id)');
$this->addSql('COMMENT ON COLUMN basket_basket_asset.basket_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN basket_basket_asset.basket_asset_id IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE basket_basket_asset ADD CONSTRAINT fk_1a9feaa51be1fb52 FOREIGN KEY (basket_id) REFERENCES basket (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE basket_basket_asset ADD CONSTRAINT fk_1a9feaa561751691 FOREIGN KEY (basket_asset_id) REFERENCES basket_asset (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE basket_asset DROP position');
$this->addSql('ALTER TABLE basket DROP description');
}
}
40 changes: 40 additions & 0 deletions databox/api/migrations/Version20240327112016.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?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 Version20240327112016 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 basket_asset DROP CONSTRAINT FK_54D711661BE1FB52');
$this->addSql('ALTER TABLE basket_asset DROP CONSTRAINT FK_54D711665DA1941');
$this->addSql('ALTER TABLE basket_asset ALTER "position" DROP DEFAULT');
$this->addSql('ALTER TABLE basket_asset ADD CONSTRAINT FK_54D711661BE1FB52 FOREIGN KEY (basket_id) REFERENCES basket (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE basket_asset ADD CONSTRAINT FK_54D711665DA1941 FOREIGN KEY (asset_id) REFERENCES asset (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}

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 basket_asset DROP CONSTRAINT fk_54d711661be1fb52');
$this->addSql('ALTER TABLE basket_asset DROP CONSTRAINT fk_54d711665da1941');
$this->addSql('ALTER TABLE basket_asset ALTER position SET DEFAULT 0');
$this->addSql('ALTER TABLE basket_asset ADD CONSTRAINT fk_54d711661be1fb52 FOREIGN KEY (basket_id) REFERENCES basket (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE basket_asset ADD CONSTRAINT fk_54d711665da1941 FOREIGN KEY (asset_id) REFERENCES asset (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
}
Loading

0 comments on commit d13e79b

Please sign in to comment.