Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhiltri committed Apr 7, 2023
2 parents f38e05f + 19708ea commit b9684e4
Show file tree
Hide file tree
Showing 20 changed files with 625 additions and 1,505 deletions.
13 changes: 6 additions & 7 deletions .env.testing.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ APP_KEY=
APP_DEBUG=true
APP_URL='http://api.test'

# Also defined in phpunit.xml?
APP_ENV='testing'

DB_CONNECTION='testing'

# WEB-1801: Uncomment for paratest
# DB_DATABASE=':memory:'
DB_CONNECTION='mysql'
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE='testing'
DB_USERNAME='homestead'
DB_PASSWORD='secret'

SCOUT_DRIVER=null
668 changes: 0 additions & 668 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6
1.8
1 change: 1 addition & 0 deletions app/Models/Collections/Artwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Artwork extends CollectionsModel

protected $casts = [
'alt_titles' => 'array',
'dimensions_detail' => 'array',
'is_public_domain' => 'boolean',
'is_zoomable' => 'boolean',
'is_on_view' => 'boolean',
Expand Down
20 changes: 20 additions & 0 deletions app/Transformers/Outbound/Collections/Artwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,22 @@ protected function getFields()
'type' => 'string',
'elasticsearch' => 'keyword',
],
'dimensions_detail' => [
'doc' => 'The height, width, depth, and/or diameter of each section of the work in centimeters',
'type' => 'object',
'elasticsearch' => [
'mapping' => [
'type' => 'object',
'properties' => [
'clarification' => ['type' => 'text'],
'depth' => ['type' => 'float'],
'diameter' => ['type' => 'float'],
'height' => ['type' => 'float'],
'width' => ['type' => 'float'],
],
],
],
],
'medium_display' => [
'doc' => 'The substances or materials used in the creation of a work',
'type' => 'string',
Expand Down Expand Up @@ -255,6 +271,10 @@ protected function getFields()
return $item->provenance;
},
],
'edition' => [
'doc' => 'Edition number if the work is one of many',
'type' => 'text',
],

/**
* Publishing fields:
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"aic/data-hub-foundation": "dev-laravel-8-support",
"aic/laravel-scout-elastic": "dev-master",
"cviebrock/laravel-elasticsearch": "^9.0",
"doctrine/dbal": "^2.13",
"fruitcake/laravel-cors": "^2.0",
"intervention/image": "^2.7",
"jsq/amazon-es-php": "dev-master",
Expand Down
24 changes: 12 additions & 12 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions config/database.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Illuminate\Database\DBAL\TimestampType;
use Illuminate\Support\Str;

$config = [
Expand Down Expand Up @@ -113,6 +114,20 @@

'migrations' => 'migrations',

/*
|--------------------------------------------------------------------------
| Column Types
|--------------------------------------------------------------------------
| This allows for modifying `timestamp` columns in migrations.
| See https://laravel.com/docs/8.x/migrations#prerequisites.
*/

'dbal' => [
'types' => [
'timestamp' => TimestampType::class,
],
],

/*
|--------------------------------------------------------------------------
| Redis Databases
Expand Down
17 changes: 17 additions & 0 deletions database/factories/Collections/ArtworkFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function definition()
'description' => $this->faker->paragraph(5),
'artist_display' => $artist->title_raw . "\n" . $this->faker->country . ', ' . $this->faker->year . '' . $this->faker->year,
'dimensions' => $this->faker->randomFloat(1, 0, 200) . ' x ' . $this->faker->randomFloat(1, 0, 200) . ' (' . $this->faker->randomNumber(2) . $this->faker->randomElement(['', ' 1/8', ' 1/4', ' 3/8', ' 1/2', ' 5/8', ' 3/4', ' 7/8']) . ' x ' . $this->faker->randomNumber(2) . $this->faker->randomElement(['', ' 1/8', ' 1/4', ' 3/8', ' 1/2', ' 5/8', ' 3/4', ' 7/8']) . ' in.)',
'dimensions_detail' => $this->fakeDimensionsDetail(3),
'medium_display' => ucfirst($this->faker->word) . ' on ' . $this->faker->word,
'credit_line' => $this->faker->randomElement(['', 'Friends of ', 'Gift of ', 'Bequest of ']) . $this->faker->words(3, true),
'inscriptions' => $this->faker->words(4, true),
Expand All @@ -36,8 +37,24 @@ public function definition()
'copyright_notice' => '© ' . $this->faker->year . ' ' . ucfirst($this->faker->words(3, true)),
'artwork_type_id' => $this->faker->randomElement(ArtworkType::query()->pluck('id')->all()),
'gallery_id' => $this->faker->randomElement(Place::query()->pluck('id')->all()),
'edition' => $this->faker->randomNumber(1) . ' of ' . $this->faker->randomNumber(2, true),
],
$this->dates(true)
);
}

protected function fakeDimensionsDetail(int $count = 1): array
{
$dimensions = array();
for ($i = 0; $i < $count; $i++) {
$dimensions[] = [
'clarification' => ucfirst($this->faker->word()),
'diameter' => $this->faker->randomFloat(),
'depth' => $this->faker->randomFloat(),
'height' => $this->faker->randomFloat(),
'width' => $this->faker->randomFloat(),
];
}
return $dimensions;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddEditionColumnToArtworksTable extends Migration
{
public function up()
{
Schema::table('artworks', function (Blueprint $table) {
$table->text('edition')->nullable();
});
}

public function down()
{
Schema::table('artworks', function (Blueprint $table) {
$table->dropColumn('edition');
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddDimensionsDetailColumnToArtworksTable extends Migration
{
public function up()
{
Schema::table('artworks', function (Blueprint $table) {
$table->json('dimensions_detail')->nullable();
});
}

public function down()
{
Schema::table('artworks', function (Blueprint $table) {
$table->dropColumn('dimensions_detail');
});
}
}
Loading

0 comments on commit b9684e4

Please sign in to comment.