From 4e378c8a5744de5a9021305b13483b6282693b2b Mon Sep 17 00:00:00 2001 From: philipp lang Date: Sun, 28 Jan 2024 11:42:32 +0100 Subject: [PATCH] Add member search via meilisearch --- .app.env.example | 2 + app/Http/Views/ActivityFilterScope.php | 8 +- app/Invoice/Models/InvoicePosition.php | 4 + app/Lib/Filter.php | 56 +- app/Maildispatcher/Actions/ResyncAction.php | 4 +- app/Member/Actions/ExportAction.php | 5 +- app/Member/Actions/SearchAction.php | 11 +- app/Member/FilterScope.php | 142 ++-- app/Member/Member.php | 41 +- app/Member/MemberController.php | 8 +- app/Member/Membership.php | 10 + config/scout.php | 6 +- database/schema/mysql-schema.sql | 626 ++++++++++++++++++ docker-compose.yml | 5 +- resources/js/components/form/Text.vue | 1 - resources/js/composables/useSearch.js | 21 + resources/js/views/contribution/VIndex.vue | 180 ++--- .../maildispatcher/MaildispatcherForm.vue | 77 ++- resources/views/app.blade.php | 4 + .../Maildispatcher/StoreTest.php | 11 +- .../Maildispatcher/UpdateTest.php | 16 +- tests/EndToEnd/MassstoreActionTest.php | 5 +- .../Member/ExportCsvActionTest.php | 34 +- tests/EndToEnd/MemberIndexTest.php | 211 +++++- tests/EndToEnd/MemberSearchTest.php | 23 + tests/EndToEndTestCase.php | 17 + tests/Feature/Member/IndexTest.php | 60 +- tests/TestCase.php | 23 +- tests/stub/phpstan/TestResponse.stub | 1 + 29 files changed, 1218 insertions(+), 394 deletions(-) create mode 100644 database/schema/mysql-schema.sql create mode 100644 resources/js/composables/useSearch.js rename tests/{Feature => EndToEnd}/Maildispatcher/StoreTest.php (93%) rename tests/{Feature => EndToEnd}/Maildispatcher/UpdateTest.php (88%) rename tests/{Feature => EndToEnd}/Member/ExportCsvActionTest.php (50%) create mode 100644 tests/EndToEnd/MemberSearchTest.php create mode 100644 tests/EndToEndTestCase.php diff --git a/.app.env.example b/.app.env.example index 241e1308..e1fa36f8 100644 --- a/.app.env.example +++ b/.app.env.example @@ -16,6 +16,8 @@ MAIL_FROM_NAME=me DB_PASSWORD=secret_db_password MYSQL_PASSWORD=secret_db_password +MEILI_MASTER_KEY=secret_meilisearch_password + PUSHER_APP_HOST=socketi WORKERS=5 diff --git a/app/Http/Views/ActivityFilterScope.php b/app/Http/Views/ActivityFilterScope.php index e3b412e1..e557e55c 100644 --- a/app/Http/Views/ActivityFilterScope.php +++ b/app/Http/Views/ActivityFilterScope.php @@ -5,6 +5,7 @@ namespace App\Http\Views; use App\Activity; use App\Lib\Filter; use Illuminate\Database\Eloquent\Builder; +use Laravel\Scout\Builder as ScoutBuilder; use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Attributes\MapOutputName; use Spatie\LaravelData\Mappers\SnakeCaseMapper; @@ -21,12 +22,9 @@ class ActivityFilterScope extends Filter ) { } - /** - * {@inheritdoc} - */ - public function locks(): array + public function getQuery(): ScoutBuilder { - return []; + return Activity::search(''); } /** diff --git a/app/Invoice/Models/InvoicePosition.php b/app/Invoice/Models/InvoicePosition.php index f4743c8b..9592f80b 100644 --- a/app/Invoice/Models/InvoicePosition.php +++ b/app/Invoice/Models/InvoicePosition.php @@ -31,10 +31,14 @@ class InvoicePosition extends Model public static function booted(): void { + static::saved(function ($model) { + $model->member->touch(); + }); static::deleted(function ($model) { if ($model->invoice->positions()->get()->count() === 0) { $model->invoice->delete(); } + $model->member->touch(); }); } } diff --git a/app/Lib/Filter.php b/app/Lib/Filter.php index ce855661..23345679 100644 --- a/app/Lib/Filter.php +++ b/app/Lib/Filter.php @@ -2,21 +2,22 @@ namespace App\Lib; -use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; +use Laravel\Scout\Builder; use Spatie\LaravelData\Data; /** * @template T of Model + * @property Builder $query */ abstract class Filter extends Data { - public string $unsetReplacer = 'yoNee3ainge4eetiier9ogaiChoe0ahcaR3Hu1uzah8xaiv7ael7yahphai7ruG9'; /** - * @return array + * @return self */ - abstract protected function locks(): array; + abstract public function getQuery(): Builder; + protected Builder $query; /** * @param array|string|null $request @@ -35,51 +36,6 @@ abstract class Filter extends Data */ public static function fromPost(?array $post = null): static { - return static::withoutMagicalCreationFrom($post ?: [])->parseLocks(); - } - - public function parseLocks(): static - { - foreach ($this->locks() as $key => $value) { - if ($value === $this->unsetReplacer) { - continue; - } - - $this->{$key} = $value; - } - - return $this; - } - - /** - * @param mixed $value - * - * @return mixed - */ - public function when(bool $when, $value) - { - return $when ? $value : $this->unsetReplacer; - } - - /** - * @param Builder $query - * - * @return Builder - */ - protected function applyOwnOthers(Builder $query, bool $own, bool $others): Builder - { - if ($own && !$others) { - $query->where('user_id', auth()->id()); - } - - if (!$own && $others) { - $query->where('user_id', '!=', auth()->id()); - } - - if (!$own && !$others) { - $query->where('id', -1); - } - - return $query; + return static::withoutMagicalCreationFrom($post ?: []); } } diff --git a/app/Maildispatcher/Actions/ResyncAction.php b/app/Maildispatcher/Actions/ResyncAction.php index 57f1dce0..df5c68c3 100644 --- a/app/Maildispatcher/Actions/ResyncAction.php +++ b/app/Maildispatcher/Actions/ResyncAction.php @@ -25,9 +25,7 @@ class ResyncAction */ public function getResults(Maildispatcher $dispatcher): Collection { - return Member::search(data_get($dispatcher->filter, 'search', ''))->query( - fn ($q) => $q->select('*')->withFilter(FilterScope::fromPost($dispatcher->filter)) - )->get() + return FilterScope::fromPost($dispatcher->filter)->getQuery()->get() ->filter(fn ($member) => $member->email || $member->email_parents) ->map(fn ($member) => MailEntry::from(['email' => $member->email ?: $member->email_parents])) ->unique(fn ($member) => $member->email); diff --git a/app/Member/Actions/ExportAction.php b/app/Member/Actions/ExportAction.php index a83833d2..b6b9389e 100644 --- a/app/Member/Actions/ExportAction.php +++ b/app/Member/Actions/ExportAction.php @@ -43,9 +43,8 @@ class ExportAction public function asController(ActionRequest $request): StreamedResponse { - $filter = FilterScope::fromRequest($request->input('filter')); - - $contents = $this->handle(Member::ordered()->withFilter($filter)->get()); + $members = FilterScope::fromRequest($request->input('filter'))->getQuery()->get(); + $contents = $this->handle($members); Storage::disk('temp')->put('mitglieder.csv', $contents); diff --git a/app/Member/Actions/SearchAction.php b/app/Member/Actions/SearchAction.php index 279e055b..32b724bf 100644 --- a/app/Member/Actions/SearchAction.php +++ b/app/Member/Actions/SearchAction.php @@ -15,19 +15,16 @@ class SearchAction use AsAction; /** + * @param array $filter * @return LengthAwarePaginator */ - public function handle(FilterScope $filter, int $perPage): LengthAwarePaginator + public function handle(array $filter, int $perPage): LengthAwarePaginator { - return Member::search($filter->search)->query( - fn ($q) => $q->select('*') - ->withFilter($filter) - ->ordered() - )->paginate($perPage); + return FilterScope::fromPost($filter)->getQuery()->paginate($perPage); } public function asController(ActionRequest $request): AnonymousResourceCollection { - return MemberResource::collection($this->handle(FilterScope::fromRequest($request->input('filter', '')), $request->input('per_page', 15))); + return MemberResource::collection($this->handle($request->input('filter', []), $request->input('per_page', 15))); } } diff --git a/app/Member/FilterScope.php b/app/Member/FilterScope.php index 50fe57dd..3cb9ded7 100644 --- a/app/Member/FilterScope.php +++ b/app/Member/FilterScope.php @@ -4,7 +4,8 @@ namespace App\Member; use App\Invoice\BillKind; use App\Lib\Filter; -use Illuminate\Database\Eloquent\Builder; +use Illuminate\Support\Collection; +use Laravel\Scout\Builder; use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Attributes\MapOutputName; use Spatie\LaravelData\Mappers\SnakeCaseMapper; @@ -37,72 +38,93 @@ class FilterScope extends Filter ) { } - /** - * {@inheritdoc} - */ - public function locks(): array + public function getQuery(): Builder { - return []; - } + $this->search = $this->search ?: ''; - /** - * @param Builder $query - * - * @return Builder - */ - public function apply(Builder $query): Builder - { - return $query->where(function ($query) { - $query->orWhere(function ($query) { - if ($this->ausstand) { - $query->whereAusstand(); - } + return Member::search($this->search, function ($engine, string $query, array $options) { + $filter = collect([]); - if ($this->billKind) { - $query->where('bill_kind', BillKind::fromValue($this->billKind)); - } + if ($this->hasFullAddress === true) { + $filter->push('address IS NOT EMPTY'); + } + if ($this->hasFullAddress === false) { + $filter->push('address IS EMPTY'); + } + if ($this->hasBirthday === false) { + $filter->push('birthday IS NULL'); + } + if ($this->hasBirthday === true) { + $filter->push('birthday IS NOT NULL'); + } + if ($this->ausstand === true) { + $filter->push('ausstand > 0'); + } + if ($this->billKind) { + $filter->push('bill_kind = ' . BillKind::fromValue($this->billKind)->value); + } + if (count($this->groupIds)) { + $filter->push($this->inExpression('group_id', $this->groupIds)); + } + if (!$this->subactivityIds && $this->activityIds) { + $filter->push($this->inExpression('memberships.activity_id', $this->activityIds)); + } + if ($this->subactivityIds && !$this->activityIds) { + $filter->push($this->inExpression('memberships.subactivity_id', $this->subactivityIds)); + } + if ($this->subactivityIds && $this->activityIds) { + $combinations = collect($this->activityIds) + ->map(fn ($activityId) => collect($this->subactivityIds)->map(fn ($subactivityId) => $activityId . '|' . $subactivityId)) + ->flatten() + ->map(fn ($combination) => str($combination)->wrap('"')); + $filter->push($this->inExpression('memberships.both', $combinations)); + } - if (true === $this->hasFullAddress) { - $query->whereNotNull('address')->whereNotNull('zip')->whereNotNull('location')->where('address', '!=', '')->where('zip', '!=', '')->where('location', '!=', ''); - } + if (count($this->exclude)) { + $filter->push($this->notInExpression('id', $this->exclude)); + } - if (false === $this->hasFullAddress) { - $query->where( - fn ($q) => $q - ->orWhere('address', '')->orWhereNull('address') - ->orWhere('zip', '')->orWhereNull('zip') - ->orWhere('location', '')->orWhereNull('location') - ); - } + $andFilter = $filter->map(fn ($expression) => "($expression)")->implode(' AND '); - if (true === $this->hasBirthday) { - $query->whereNotNull('birthday'); - } + $options['filter'] = $this->implode(collect([$andFilter])->push($this->inExpression('id', $this->include)), 'OR'); + $options['sort'] = ['lastname:asc', 'firstname:asc']; - if (count($this->groupIds)) { - $query->whereIn('group_id', $this->groupIds); - } - - if (count($this->subactivityIds) + count($this->activityIds) > 0) { - $query->whereHas('memberships', function ($q) { - $q->active(); - if (count($this->subactivityIds)) { - $q->whereIn('subactivity_id', $this->subactivityIds); - } - if (count($this->activityIds)) { - $q->whereIn('activity_id', $this->activityIds); - } - }); - } - - if (count($this->exclude)) { - $query->whereNotIn('id', $this->exclude); - } - })->orWhere(function ($query) { - if (count($this->include)) { - $query->whereIn('id', $this->include); - } - }); + return $engine->search($query, $options); }); } + + /** + * @param Collection $values + */ + protected function implode(Collection $values, string $between): string + { + return $values->filter(fn ($expression) => $expression)->implode(" {$between} "); + } + + /** + * @param array|Collection $values + */ + private function inExpression(string $key, array|Collection $values): ?string + { + if (!count($values)) { + return null; + } + $valueString = Collection::wrap($values)->implode(','); + + return "$key IN [{$valueString}]"; + } + + /** + * @param array|Collection $values + */ + private function notInExpression(string $key, array|Collection $values): ?string + { + if (!count($values)) { + return null; + } + + $valueString = Collection::wrap($values)->implode(','); + + return "$key NOT IN [{$valueString}]"; + } } diff --git a/app/Member/Member.php b/app/Member/Member.php index 1e51d8f3..3320b758 100644 --- a/app/Member/Member.php +++ b/app/Member/Member.php @@ -149,7 +149,9 @@ class Member extends Model implements Geolocatable public function getFullAddressAttribute(): string { - return $this->address . ', ' . $this->zip . ' ' . $this->location; + return $this->address && $this->zip && $this->location + ? $this->address . ', ' . $this->zip . ' ' . $this->location + : ''; } public function getEfzLink(): ?string @@ -178,6 +180,11 @@ class Member extends Model implements Geolocatable return $this->birthday?->diffInYears(now()); } + protected function getAusstand(): int + { + return (int) $this->invoicePositions()->whereHas('invoice', fn ($query) => $query->whereNeedsPayment())->sum('price'); + } + // ---------------------------------- Relations ---------------------------------- /** * @return BelongsTo @@ -324,18 +331,6 @@ class Member extends Model implements Geolocatable return $query->whereHas('invoicePositions', fn ($q) => $q->whereHas('invoice', fn ($q) => $q->whereNeedsPayment())); } - /** - * @param Builder $query - * - * @return Builder - */ - public function scopeWhereAusstand(Builder $query): Builder - { - return $query->whereHas('invoicePositions', function ($q) { - return $q->whereHas('invoice', fn ($query) => $query->whereNeedsPayment()); - }); - } - /** * @param Builder $query * @@ -356,18 +351,6 @@ class Member extends Model implements Geolocatable return $query->selectRaw('SUM(id)'); } - /** - * @todo refactor this to an actual filter model - * - * @param Builder $query - * - * @return Builder - */ - public function scopeWithFilter(Builder $query, FilterScope $filter): Builder - { - return $filter->apply($query); - } - /** * @param Builder $query * @@ -512,6 +495,14 @@ class Member extends Model implements Geolocatable return [ 'address' => $this->fullAddress, 'fullname' => $this->fullname, + 'firstname' => $this->firstname, + 'lastname' => $this->lastname, + 'birthday' => $this->birthday?->format('Y-m-d'), + 'ausstand' => $this->getAusstand(), + 'bill_kind' => $this->bill_kind?->value, + 'group_id' => $this->group->id, + 'memberships' => $this->memberships()->active()->get() + ->map(fn ($membership) => [...$membership->only('activity_id', 'subactivity_id'), 'both' => $membership->activity_id . '|' . $membership->subactivity_id]), ]; } } diff --git a/app/Member/MemberController.php b/app/Member/MemberController.php index efcbf8d2..ed40b65a 100644 --- a/app/Member/MemberController.php +++ b/app/Member/MemberController.php @@ -17,15 +17,13 @@ class MemberController extends Controller { session()->put('menu', 'member'); session()->put('title', 'Mitglieder'); - $filter = FilterScope::fromRequest($request->input('filter', '')); return Inertia::render('member/VIndex', [ - 'data' => MemberResource::collection(Member::search($filter->search)->query( - fn ($q) => $q->select('*') - ->withFilter($filter) + 'data' => MemberResource::collection(FilterScope::fromRequest($request->input('filter', ''))->getQuery()->query( + fn ($q) => $q + ->select('*') ->with(['gender', 'subscription', 'leaderMemberships', 'ageGroupMemberships.subactivity']) ->withPendingPayment() - ->ordered() )->paginate(15)), ]); } diff --git a/app/Member/Membership.php b/app/Member/Membership.php index bb1b1fc3..621eaebf 100644 --- a/app/Member/Membership.php +++ b/app/Member/Membership.php @@ -116,4 +116,14 @@ class Membership extends Model { return $query->active()->whereHas('activity', fn ($builder) => $builder->where('is_try', true)); } + + public static function booted(): void + { + static::saved(function ($membership) { + $membership->member->touch(); + }); + static::deleted(function ($membership) { + $membership->member->touch(); + }); + } } diff --git a/config/scout.php b/config/scout.php index 102fb507..f260a9df 100644 --- a/config/scout.php +++ b/config/scout.php @@ -133,10 +133,12 @@ return [ 'meilisearch' => [ 'host' => env('MEILISEARCH_HOST', 'http://localhost:7700'), - 'key' => env('MEILISEARCH_KEY', null), + 'key' => env('MEILI_MASTER_KEY', null), 'index-settings' => [ Member::class => [ - 'filterableAttributes' => ['fullname', 'address'], + 'filterableAttributes' => ['address', 'birthday', 'ausstand', 'bill_kind', 'group_id', 'memberships', 'id'], + 'searchableAttributes' => ['fullname', 'address'], + 'sortableAttributes' => ['lastname', 'firstname'], ] ], ], diff --git a/database/schema/mysql-schema.sql b/database/schema/mysql-schema.sql new file mode 100644 index 00000000..5e8aa3c8 --- /dev/null +++ b/database/schema/mysql-schema.sql @@ -0,0 +1,626 @@ +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `activities`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `activities` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `slug` varchar(255) NOT NULL, + `is_filterable` tinyint(1) NOT NULL DEFAULT 0, + `is_member` tinyint(1) NOT NULL DEFAULT 0, + `is_try` tinyint(1) NOT NULL DEFAULT 0, + `nami_id` int(10) unsigned DEFAULT NULL, + `has_efz` tinyint(1) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `activity_subactivity`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `activity_subactivity` ( + `activity_id` bigint(20) unsigned NOT NULL, + `subactivity_id` bigint(20) unsigned NOT NULL, + UNIQUE KEY `activity_subactivity_activity_id_subactivity_id_unique` (`activity_id`,`subactivity_id`), + KEY `activity_subactivity_subactivity_id_foreign` (`subactivity_id`), + CONSTRAINT `activity_subactivity_activity_id_foreign` FOREIGN KEY (`activity_id`) REFERENCES `activities` (`id`), + CONSTRAINT `activity_subactivity_subactivity_id_foreign` FOREIGN KEY (`subactivity_id`) REFERENCES `subactivities` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `confessions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `confessions` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `nami_id` int(10) unsigned DEFAULT NULL, + `is_null` tinyint(1) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `countries`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `countries` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `nami_id` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `course_members`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `course_members` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `member_id` bigint(20) unsigned NOT NULL, + `course_id` bigint(20) unsigned NOT NULL, + `organizer` varchar(255) NOT NULL, + `event_name` varchar(255) NOT NULL, + `nami_id` int(10) unsigned NOT NULL, + `completed_at` date NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `course_members_member_id_foreign` (`member_id`), + KEY `course_members_course_id_foreign` (`course_id`), + CONSTRAINT `course_members_course_id_foreign` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`), + CONSTRAINT `course_members_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `courses`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `courses` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `nami_id` int(10) unsigned NOT NULL, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `failed_jobs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `failed_jobs` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `connection` text NOT NULL, + `queue` text NOT NULL, + `payload` longtext NOT NULL, + `exception` longtext NOT NULL, + `failed_at` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `fees`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `fees` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `nami_id` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `genders`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `genders` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `nami_id` int(10) unsigned NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `groups`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `groups` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `nami_id` int(10) unsigned NOT NULL, + `parent_id` bigint(20) unsigned DEFAULT NULL, + `inner_name` varchar(255) NOT NULL, + `level` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `groups_parent_id_foreign` (`parent_id`), + CONSTRAINT `groups_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `groups` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `invoice_positions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoice_positions` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `invoice_id` bigint(20) unsigned NOT NULL, + `description` varchar(255) NOT NULL, + `member_id` bigint(20) unsigned NOT NULL, + `price` bigint(20) unsigned NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `invoices`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoices` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `to` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`to`)), + `greeting` varchar(255) NOT NULL, + `status` varchar(255) NOT NULL, + `sent_at` date DEFAULT NULL, + `via` varchar(255) NOT NULL, + `usage` varchar(255) NOT NULL, + `mail_email` varchar(255) DEFAULT NULL, + `last_remembered_at` datetime DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `job_batches`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `job_batches` ( + `id` varchar(255) NOT NULL, + `name` varchar(255) NOT NULL, + `total_jobs` int(11) NOT NULL, + `pending_jobs` int(11) NOT NULL, + `failed_jobs` int(11) NOT NULL, + `failed_job_ids` longtext NOT NULL, + `options` mediumtext DEFAULT NULL, + `cancelled_at` int(11) DEFAULT NULL, + `created_at` int(11) NOT NULL, + `finished_at` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `localmaildispatchers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `localmaildispatchers` ( + `id` char(36) NOT NULL, + `from` varchar(255) NOT NULL, + `to` varchar(255) NOT NULL, + UNIQUE KEY `localmaildispatchers_from_to_unique` (`from`,`to`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `maildispatchers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `maildispatchers` ( + `id` char(36) NOT NULL, + `name` varchar(255) NOT NULL, + `gateway_id` char(36) NOT NULL, + `filter` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`filter`)) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `mailgateways`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mailgateways` ( + `id` char(36) NOT NULL, + `name` varchar(255) NOT NULL, + `domain` varchar(255) NOT NULL, + `type` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`type`)), + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `members`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `members` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `firstname` varchar(255) NOT NULL, + `lastname` varchar(255) NOT NULL, + `nickname` varchar(255) DEFAULT NULL, + `gender_id` bigint(20) unsigned DEFAULT NULL, + `country_id` bigint(20) unsigned DEFAULT NULL, + `other_country` varchar(255) DEFAULT NULL, + `confession_id` bigint(20) unsigned DEFAULT NULL, + `birthday` date DEFAULT NULL, + `joined_at` date DEFAULT NULL, + `send_newspaper` tinyint(1) NOT NULL, + `address` varchar(255) DEFAULT NULL, + `further_address` varchar(255) DEFAULT NULL, + `zip` varchar(255) DEFAULT NULL, + `location` varchar(255) DEFAULT NULL, + `group_id` bigint(20) unsigned NOT NULL, + `region_id` bigint(20) unsigned DEFAULT NULL, + `main_phone` varchar(255) DEFAULT NULL, + `mobile_phone` varchar(255) DEFAULT NULL, + `work_phone` varchar(255) DEFAULT NULL, + `fax` varchar(255) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `email_parents` varchar(255) DEFAULT NULL, + `nami_id` int(11) DEFAULT NULL, + `nationality_id` bigint(20) unsigned DEFAULT NULL, + `letter_address` text DEFAULT NULL, + `bill_kind` varchar(255) DEFAULT NULL, + `version` int(10) unsigned NOT NULL DEFAULT 1, + `children_phone` varchar(255) DEFAULT NULL, + `subscription_id` bigint(20) unsigned DEFAULT 1, + `efz` date DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `ps_at` date DEFAULT NULL, + `more_ps_at` date DEFAULT NULL, + `without_education_at` date DEFAULT NULL, + `without_efz_at` date DEFAULT NULL, + `has_svk` tinyint(1) NOT NULL DEFAULT 0, + `has_vk` tinyint(1) NOT NULL DEFAULT 0, + `multiply_pv` tinyint(1) NOT NULL DEFAULT 0, + `multiply_more_pv` tinyint(1) NOT NULL DEFAULT 0, + `slug` varchar(100) NOT NULL, + `salutation` varchar(255) DEFAULT NULL, + `comment` text DEFAULT NULL, + `mitgliedsnr` varchar(255) DEFAULT NULL, + `lat` double DEFAULT NULL, + `lon` double DEFAULT NULL, + `recertified_at` date DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `members_gender_id_foreign` (`gender_id`), + KEY `members_country_id_foreign` (`country_id`), + KEY `members_confession_id_foreign` (`confession_id`), + KEY `members_group_id_foreign` (`group_id`), + KEY `members_region_id_foreign` (`region_id`), + KEY `members_nationality_id_foreign` (`nationality_id`), + KEY `members_bill_kind_id_foreign` (`bill_kind`), + KEY `members_subscription_id_foreign` (`subscription_id`), + CONSTRAINT `members_confession_id_foreign` FOREIGN KEY (`confession_id`) REFERENCES `confessions` (`id`), + CONSTRAINT `members_country_id_foreign` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`), + CONSTRAINT `members_gender_id_foreign` FOREIGN KEY (`gender_id`) REFERENCES `genders` (`id`), + CONSTRAINT `members_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`), + CONSTRAINT `members_nationality_id_foreign` FOREIGN KEY (`nationality_id`) REFERENCES `nationalities` (`id`), + CONSTRAINT `members_region_id_foreign` FOREIGN KEY (`region_id`) REFERENCES `regions` (`id`), + CONSTRAINT `members_subscription_id_foreign` FOREIGN KEY (`subscription_id`) REFERENCES `subscriptions` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `memberships`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `memberships` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `group_id` bigint(20) unsigned NOT NULL, + `member_id` bigint(20) unsigned NOT NULL, + `nami_id` int(10) unsigned DEFAULT NULL, + `from` datetime NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `activity_id` bigint(20) unsigned NOT NULL, + `subactivity_id` bigint(20) unsigned DEFAULT NULL, + `promised_at` date DEFAULT NULL, + `to` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `memberships_unique` (`activity_id`,`subactivity_id`,`group_id`,`member_id`,`nami_id`), + KEY `memberships_group_id_foreign` (`group_id`), + KEY `memberships_subactivity_id_foreign` (`subactivity_id`), + KEY `memberships_member_id_foreign` (`member_id`), + CONSTRAINT `memberships_activity_id_foreign` FOREIGN KEY (`activity_id`) REFERENCES `activities` (`id`), + CONSTRAINT `memberships_group_id_foreign` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`), + CONSTRAINT `memberships_member_id_foreign` FOREIGN KEY (`member_id`) REFERENCES `members` (`id`), + CONSTRAINT `memberships_subactivity_id_foreign` FOREIGN KEY (`subactivity_id`) REFERENCES `subactivities` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `migrations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `migrations` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `migration` varchar(255) NOT NULL, + `batch` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `nationalities`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `nationalities` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `nami_id` int(10) unsigned NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `oauth_access_tokens`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `oauth_access_tokens` ( + `id` varchar(100) NOT NULL, + `user_id` bigint(20) unsigned DEFAULT NULL, + `client_id` bigint(20) unsigned NOT NULL, + `name` varchar(255) DEFAULT NULL, + `scopes` text DEFAULT NULL, + `revoked` tinyint(1) NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `expires_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `oauth_access_tokens_user_id_index` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `oauth_auth_codes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `oauth_auth_codes` ( + `id` varchar(100) NOT NULL, + `user_id` bigint(20) unsigned NOT NULL, + `client_id` bigint(20) unsigned NOT NULL, + `scopes` text DEFAULT NULL, + `revoked` tinyint(1) NOT NULL, + `expires_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `oauth_auth_codes_user_id_index` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `oauth_clients`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `oauth_clients` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `user_id` bigint(20) unsigned DEFAULT NULL, + `name` varchar(255) NOT NULL, + `secret` varchar(100) DEFAULT NULL, + `provider` varchar(255) DEFAULT NULL, + `redirect` text NOT NULL, + `personal_access_client` tinyint(1) NOT NULL, + `password_client` tinyint(1) NOT NULL, + `revoked` tinyint(1) NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `oauth_clients_user_id_index` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `oauth_personal_access_clients`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `oauth_personal_access_clients` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `client_id` bigint(20) unsigned NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `oauth_refresh_tokens`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `oauth_refresh_tokens` ( + `id` varchar(100) NOT NULL, + `access_token_id` varchar(100) NOT NULL, + `revoked` tinyint(1) NOT NULL, + `expires_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `oauth_refresh_tokens_access_token_id_index` (`access_token_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `password_resets`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `password_resets` ( + `email` varchar(255) NOT NULL, + `token` varchar(255) NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + KEY `password_resets_email_index` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `regions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `regions` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `is_null` tinyint(1) NOT NULL, + `nami_id` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `settings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `settings` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `group` varchar(255) NOT NULL, + `name` varchar(255) NOT NULL, + `locked` tinyint(1) NOT NULL, + `payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`payload`)), + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `settings_group_index` (`group`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `statuses`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `statuses` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `is_bill` tinyint(1) NOT NULL, + `is_remember` tinyint(1) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `subactivities`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `subactivities` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `slug` varchar(255) NOT NULL, + `is_age_group` tinyint(1) NOT NULL DEFAULT 0, + `is_filterable` tinyint(1) NOT NULL DEFAULT 0, + `nami_id` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `subscription_children`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `subscription_children` ( + `id` char(36) NOT NULL, + `parent_id` bigint(20) unsigned NOT NULL, + `name` varchar(255) NOT NULL, + `amount` int(10) unsigned NOT NULL, + KEY `subscription_children_parent_id_foreign` (`parent_id`), + CONSTRAINT `subscription_children_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `subscriptions` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `subscriptions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `subscriptions` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `fee_id` bigint(20) unsigned NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `subscriptions_fee_id_foreign` (`fee_id`), + CONSTRAINT `subscriptions_fee_id_foreign` FOREIGN KEY (`fee_id`) REFERENCES `fees` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `telescope_entries`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `telescope_entries` ( + `sequence` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `uuid` char(36) NOT NULL, + `batch_id` char(36) NOT NULL, + `family_hash` varchar(255) DEFAULT NULL, + `should_display_on_index` tinyint(1) NOT NULL DEFAULT 1, + `type` varchar(20) NOT NULL, + `content` longtext NOT NULL, + `created_at` datetime DEFAULT NULL, + PRIMARY KEY (`sequence`), + UNIQUE KEY `telescope_entries_uuid_unique` (`uuid`), + KEY `telescope_entries_batch_id_index` (`batch_id`), + KEY `telescope_entries_family_hash_index` (`family_hash`), + KEY `telescope_entries_created_at_index` (`created_at`), + KEY `telescope_entries_type_should_display_on_index_index` (`type`,`should_display_on_index`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `telescope_entries_tags`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `telescope_entries_tags` ( + `entry_uuid` char(36) NOT NULL, + `tag` varchar(255) NOT NULL, + KEY `telescope_entries_tags_entry_uuid_tag_index` (`entry_uuid`,`tag`), + KEY `telescope_entries_tags_tag_index` (`tag`), + CONSTRAINT `telescope_entries_tags_entry_uuid_foreign` FOREIGN KEY (`entry_uuid`) REFERENCES `telescope_entries` (`uuid`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `telescope_monitoring`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `telescope_monitoring` ( + `tag` varchar(255) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `users` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `email` varchar(255) NOT NULL, + `name` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `email_verified_at` timestamp NULL DEFAULT NULL, + `remember_token` varchar(100) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `users_email_unique` (`email`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE IF EXISTS `ways`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ways` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `title` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +INSERT INTO `migrations` VALUES (1,'2010_08_08_100000_create_telescope_entries_table',1); +INSERT INTO `migrations` VALUES (2,'2010_08_19_000000_create_failed_jobs_table',1); +INSERT INTO `migrations` VALUES (3,'2014_10_12_100000_create_password_resets_table',1); +INSERT INTO `migrations` VALUES (4,'2016_06_01_000001_create_oauth_auth_codes_table',1); +INSERT INTO `migrations` VALUES (5,'2016_06_01_000002_create_oauth_access_tokens_table',1); +INSERT INTO `migrations` VALUES (6,'2016_06_01_000003_create_oauth_refresh_tokens_table',1); +INSERT INTO `migrations` VALUES (7,'2016_06_01_000004_create_oauth_clients_table',1); +INSERT INTO `migrations` VALUES (8,'2016_06_01_000005_create_oauth_personal_access_clients_table',1); +INSERT INTO `migrations` VALUES (9,'2017_01_14_235348_create_nationalities_table',1); +INSERT INTO `migrations` VALUES (10,'2017_01_22_235143_create_subscriptions_table',1); +INSERT INTO `migrations` VALUES (11,'2017_04_12_010000_create_groups_table',1); +INSERT INTO `migrations` VALUES (12,'2017_07_04_235624_create_countries_table',1); +INSERT INTO `migrations` VALUES (13,'2017_07_05_000438_create_genders_table',1); +INSERT INTO `migrations` VALUES (14,'2017_07_05_000810_create_regions_table',1); +INSERT INTO `migrations` VALUES (15,'2017_07_05_001729_create_confessions_table',1); +INSERT INTO `migrations` VALUES (16,'2017_12_25_231219_create_ways_table',1); +INSERT INTO `migrations` VALUES (17,'2018_01_16_012910_create_activities_table',1); +INSERT INTO `migrations` VALUES (18,'2020_04_12_223230_create_members_table',1); +INSERT INTO `migrations` VALUES (19,'2021_07_04_101300_create_payments_table',1); +INSERT INTO `migrations` VALUES (20,'2021_11_18_001427_create_courses_table',1); +INSERT INTO `migrations` VALUES (21,'2021_11_18_215522_create_settings_table',1); +INSERT INTO `migrations` VALUES (22,'2021_11_18_230152_create_general_settings',1); +INSERT INTO `migrations` VALUES (23,'2021_11_22_233113_create_allowed_nami_login_setting',1); +INSERT INTO `migrations` VALUES (24,'2021_11_23_173033_create_users_table',1); +INSERT INTO `migrations` VALUES (25,'2022_01_18_205354_create_memberships_table',1); +INSERT INTO `migrations` VALUES (26,'2022_02_17_011021_create_groups_parent_id_column',1); +INSERT INTO `migrations` VALUES (27,'2022_02_19_230152_create_nami_settings',1); +INSERT INTO `migrations` VALUES (28,'2022_03_15_152907_create_members_efz_column',1); +INSERT INTO `migrations` VALUES (29,'2022_03_20_145006_create_activities_has_efz_column',1); +INSERT INTO `migrations` VALUES (30,'2022_04_28_203444_create_members_prevention_column',1); +INSERT INTO `migrations` VALUES (31,'2022_05_01_185012_create_nami_settings_group',1); +INSERT INTO `migrations` VALUES (32,'2022_08_30_132503_create_users_email_verified_add_column',1); +INSERT INTO `migrations` VALUES (33,'2022_09_05_213938_bill_settings',1); +INSERT INTO `migrations` VALUES (34,'2022_10_05_171451_create_members_slug_column',1); +INSERT INTO `migrations` VALUES (35,'2022_10_18_123917_mailman_settings',1); +INSERT INTO `migrations` VALUES (36,'2022_10_18_123918_mailman_is_active',1); +INSERT INTO `migrations` VALUES (37,'2022_10_18_123919_mailman_lists',1); +INSERT INTO `migrations` VALUES (38,'2022_11_05_213938_iban_settings',1); +INSERT INTO `migrations` VALUES (39,'2022_11_08_154408_create_memberships_activity_column',1); +INSERT INTO `migrations` VALUES (40,'2022_11_23_220958_drop_members_confirmed_at_column',1); +INSERT INTO `migrations` VALUES (41,'2022_12_06_211901_edit_members_bill_kind_id_column',1); +INSERT INTO `migrations` VALUES (42,'2022_12_11_192600_create_memberships_has_promise_column',1); +INSERT INTO `migrations` VALUES (43,'2022_12_13_203644_create_subscription_children_table',1); +INSERT INTO `migrations` VALUES (44,'2023_02_05_233824_create_memberships_to_column',1); +INSERT INTO `migrations` VALUES (45,'2023_02_05_235353_edit_activities_nami_id_column',1); +INSERT INTO `migrations` VALUES (46,'2023_02_12_223932_create_job_batches_table',1); +INSERT INTO `migrations` VALUES (47,'2023_02_26_192658_create_members_search_column',1); +INSERT INTO `migrations` VALUES (48,'2023_02_27_213656_create_members_salutation_column',1); +INSERT INTO `migrations` VALUES (49,'2023_02_27_221231_create_members_comment_column',1); +INSERT INTO `migrations` VALUES (50,'2023_03_02_220832_create_members_mitgliedsnr_column',1); +INSERT INTO `migrations` VALUES (51,'2023_03_05_230539_edit_members_birthday_column',1); +INSERT INTO `migrations` VALUES (52,'2023_03_05_231245_edit_members_address_column',1); +INSERT INTO `migrations` VALUES (53,'2023_05_01_185012_create_nami_search_setting',1); +INSERT INTO `migrations` VALUES (54,'2023_05_16_113849_create_members_latlon_column',1); +INSERT INTO `migrations` VALUES (55,'2023_06_01_102056_create_mailgateways_table',1); +INSERT INTO `migrations` VALUES (56,'2023_06_12_083133_create_maildispatchers_table',1); +INSERT INTO `migrations` VALUES (57,'2023_06_12_093205_create_localmaildispatchers_table',1); +INSERT INTO `migrations` VALUES (58,'2023_07_23_203851_edit_members_table',1); +INSERT INTO `migrations` VALUES (59,'2023_11_16_101137_create_module_settings',1); +INSERT INTO `migrations` VALUES (60,'2023_11_23_001310_create_invoice_data_column',1); +INSERT INTO `migrations` VALUES (61,'2023_11_24_131853_create_members_recertified_at_column',1); +INSERT INTO `migrations` VALUES (62,'2023_12_12_015320_create_invoices_table',1); +INSERT INTO `migrations` VALUES (63,'2023_12_30_012316_create_groups_inner_name_column',1); +INSERT INTO `migrations` VALUES (64,'2024_01_25_213922_drop_members_search_text_column',1); diff --git a/docker-compose.yml b/docker-compose.yml index 2afdf1b0..aa27c717 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -104,8 +104,7 @@ services: meilisearch: image: getmeili/meilisearch:v1.6 - command: 'meilisearch --master-key="abc"' volumes: - ./data/meilisearch:/meili_data - ports: - - '7700:7700' + env_file: + - .app.env diff --git a/resources/js/components/form/Text.vue b/resources/js/components/form/Text.vue index 24d6abeb..0a7a6726 100644 --- a/resources/js/components/form/Text.vue +++ b/resources/js/components/form/Text.vue @@ -340,7 +340,6 @@ export default { } }, onInput(v) { - console.log(this.modelModifiers); if (this.mode === 'none') { this.transformedValue = v.target.value; } diff --git a/resources/js/composables/useSearch.js b/resources/js/composables/useSearch.js new file mode 100644 index 00000000..be592c29 --- /dev/null +++ b/resources/js/composables/useSearch.js @@ -0,0 +1,21 @@ +import {inject} from 'vue'; + +export default function useSearch() { + const axios = inject('axios'); + async function search(text, filters = []) { + var response = await axios.post( + document.querySelector('meta[name="meilisearch_baseurl"]').content + '/indexes/members/search', + { + q: text, + filter: filters, + }, + {headers: {Authorization: 'Bearer ' + document.querySelector('meta[name="meilisearch_key"]').content}} + ); + + return response.data; + } + + return { + search, + }; +} diff --git a/resources/js/views/contribution/VIndex.vue b/resources/js/views/contribution/VIndex.vue index 3c445cc1..21c3f485 100644 --- a/resources/js/views/contribution/VIndex.vue +++ b/resources/js/views/contribution/VIndex.vue @@ -1,134 +1,90 @@ - diff --git a/resources/js/views/maildispatcher/MaildispatcherForm.vue b/resources/js/views/maildispatcher/MaildispatcherForm.vue index 1f922df5..a2b83125 100644 --- a/resources/js/views/maildispatcher/MaildispatcherForm.vue +++ b/resources/js/views/maildispatcher/MaildispatcherForm.vue @@ -10,27 +10,56 @@
- +
- - - - - + + + + +
@@ -58,8 +87,8 @@