Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-kamil committed Apr 20, 2023
0 parents commit d2aab3e
Show file tree
Hide file tree
Showing 194 changed files with 33,373 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
55 changes: 55 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

MIX_SURVEY_SK=
MIX_SURVEY_EN=
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
20 changes: 20 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Deploy "master" branch
on:
push:
branches:
- master

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
- uses: deployphp/action@v1
with:
private-key: ${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}
deployer-version: '7.0.2'
dep: deploy
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/node_modules
/public/css
/public/js
/public/fonts
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.idea
/.vscode
mix-manifest.json
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
public/js
vendor

composer.*

CHANGELOG.md
<svg></svg>
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tabWidth": 4,
"printWidth": 120,
"useTabs": false,
"singleQuote": true,
"semi": false
}
14 changes: 14 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
php:
preset: laravel
version: 8
disabled:
- no_unused_imports
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# CYOO

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Allow MKG visitors to curate own object in exhibition.

Made as a part of [DATA EXPLORATION SPRINT at MKG Hamburg](https://www.mkg-hamburg.de/en/neo-lab)

## Development

This software is built with the [Laravel framework](http://laravel.com/).

It requires

1. PHP >= 7.4.x
1. MySQL >= 5.7

## License

Source code in this repository is licensed under the MIT license. Please see the [License File](LICENSE) for more information.
43 changes: 43 additions & 0 deletions app/Console/Commands/ImportAuthorities.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace App\Console\Commands;

use App\Jobs\ImportAuthoritiesJob;
use Illuminate\Console\Command;

class ImportAuthorities extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'import:authorities';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Import authorities from airtable';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
ImportAuthoritiesJob::dispatch();
}
}
43 changes: 43 additions & 0 deletions app/Console/Commands/ImportExhibitions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace App\Console\Commands;

use App\Jobs\ImportExhibitionsJob;
use Illuminate\Console\Command;

class ImportExhibitions extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'import:exhibitions';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Import exhibitions from airtable';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
ImportExhibitionsJob::dispatch();
}
}
94 changes: 94 additions & 0 deletions app/Console/Commands/ImportItems.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php

namespace App\Console\Commands;

use Airtable;
use App\Models\Item;
use App\Models\Exhibition;
use Illuminate\Console\Command;
use Illuminate\Support\Arr;

class ImportItems extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'import:items';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Import items from airtable';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$exhibition_ids = Exhibition::all()->pluck('id');
$records = Airtable::table('items')
->where('ID', '!=', '')
->get();
$bar = $this->output->createProgressBar(count($records));
$bar->start();
$records->each(function ($record) use ($bar, $exhibition_ids) {
$bar->advance();
$item = Item::unguarded(
fn() => Item::firstOrNew([
'id' => $record['fields']['ID'],
])
);

$item->airtable_id = $record['id'];

$item->title = Arr::get($record, 'fields.Názov diela');

$item->description = [
'sk' => Arr::get($record, 'fields.app text'),
'en' => Arr::get($record, 'fields.app text preklad'),
];

$item->author_name = [
'sk' => Arr::get($record, 'fields.Autor/ka'),
'en' => Arr::get($record, 'fields.Autor/ka EN'),
];

$item->offset_top = Arr::get($record, 'fields.offsetTop', 0);

$item->save();

if ($item->code && $exhibition_ids->contains(Arr::get($record, 'fields.Výstava.0'))) {
$item->code->exhibition_id = Arr::get($record, 'fields.Výstava.0');
$item->code->save();
}

// update code in airtable
if (
\App::environment('production') &&
(empty($record['fields']['code']) || $record['fields']['code'] != $item->code->code)
) {
Airtable::table('items')->patch($record['id'], ['code' => $item->code->code]);
}
});

$bar->finish();
$this->newLine();
$this->info('Done 🎉');
}
}
Loading

0 comments on commit d2aab3e

Please sign in to comment.