Skip to content
Merged

Dev #2420

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
641a10f
Charlotte init
charlotte-matrix Dec 5, 2024
bf6ab33
Making Changes to German Event Api - adding update event function
Siroumi Dec 23, 2024
63e4073
Global Search
stevanpo Dec 23, 2024
2721cd1
Redesign Global Search
stevanpo Dec 24, 2024
1493ed8
update pagination
stevanpo Dec 24, 2024
5021dd3
Merge branch 'dev' of stevan.github.com:codeeu/codeweek into GlobalSe…
stevanpo Jan 9, 2025
6291964
Update logic global search with keyword
stevanpo Jan 9, 2025
44b2111
Fix loading position
stevanpo Jan 10, 2025
c66dded
Hompage, header, footer
stevanpo Jan 10, 2025
ab9939b
fix: conflict
stevanpo Jan 10, 2025
f215935
Separate new layout
stevanpo Jan 13, 2025
fe63419
Fix homepage feedback
stevanpo Jan 14, 2025
f48dce1
Fix feedback 4 on homepage
stevanpo Jan 14, 2025
824aa27
Fix To top button
stevanpo Jan 15, 2025
87c7183
Fix feedback on resource and training section
stevanpo Jan 15, 2025
6b8a4e6
Fix section buttons style issue on tablet
stevanpo Jan 15, 2025
7088543
Fix animations for resources
stevanpo Jan 15, 2025
72d217b
Fix feedback
stevanpo Jan 15, 2025
59e30da
Make old page not be effected with new design
stevanpo Jan 15, 2025
8a6e00f
Fix
stevanpo Jan 17, 2025
8c895db
Fix
stevanpo Jan 21, 2025
597fc63
Fix
stevanpo Jan 21, 2025
dea1aae
Fix
stevanpo Jan 22, 2025
98f6c7b
Fix
stevanpo Jan 22, 2025
0eeeafb
Fix
stevanpo Jan 23, 2025
eb15b23
Fix
stevanpo Jan 23, 2025
129d54a
Fix conflict
stevanpo Jan 24, 2025
64e2731
Fix
stevanpo Jan 27, 2025
49090e2
Fix
stevanpo Jan 27, 2025
905b293
Merge branch 'dev' of stevan.github.com:codeeu/codeweek into feat/sea…
stevanpo Jan 28, 2025
171cf7d
Merge pull request #2388 from codeeu/feat/search-homepage
stevanpo Jan 28, 2025
1c6ed6c
Fix events page restore
stevanpo Jan 28, 2025
a4b4215
Merge pull request #2419 from codeeu/fix/events
stevanpo Jan 28, 2025
33217cc
Remove layout old
stevanpo Jan 28, 2025
20b6e38
Merge pull request #2421 from codeeu/fix/remove-layout-old
stevanpo Jan 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions app/Blog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Blog extends Model
{
public $timestamps = false;

protected $fillable = [
'name',
'categories',
'tags',
'description',
'content',
'thumbnail',
'path',
'date',
'modified',
'status',
'type',
'slug'
];
}
2 changes: 1 addition & 1 deletion app/Console/Commands/Importers/Baden.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function handle(): void

$techicalUser = ImporterHelper::getTechnicalUser('baden-technical');

$items = BadenRSSItem::whereNull('imported_at')->get();
$items = BadenRSSItem::all();

foreach ($items as $item) {

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Importers/Bayern.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function handle(): void

$techicalUser = ImporterHelper::getTechnicalUser('bayern-technical');

$items = BayernRSSItem::whereNull('imported_at')->get();
$items = BayernRSSItem::all();

foreach ($items as $item) {

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Importers/Berlin.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function handle(): void

$techicalUser = ImporterHelper::getTechnicalUser('berlin-technical');

$items = BerlinRSSItem::whereNull('imported_at')->get();
$items = BerlinRSSItem::all();

foreach ($items as $item) {

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Importers/Bonn.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function handle(): void
Log::info('Loading Bonn API Items in Database');

$techicalUser = ImporterHelper::getTechnicalUser('bonn-technical');
$items = BonnRSSItem::whereNull('imported_at')->get();
$items = BonnRSSItem::all();

foreach ($items as $item) {
$item->createEvent($techicalUser);
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Importers/Bremen.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function handle(): void
Log::info('Loading Bremen API Items in Database');

$techicalUser = ImporterHelper::getTechnicalUser('bremen-technical');
$items = BremenRSSItem::whereNull('imported_at')->get();
$items = BremenRSSItem::all();

foreach ($items as $item) {
$item->createEvent($techicalUser);
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Importers/Dresden.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function handle(): void
Log::info('Loading Dresden API Items in Database');

$techicalUser = ImporterHelper::getTechnicalUser('dresden-technical');
$items = DresdenRSSItem::whereNull('imported_at')->get();
$items = DresdenRSSItem::all();

foreach ($items as $item) {
$item->createEvent($techicalUser);
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Importers/Hamburg.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function handle(): void
Log::info('Loading Hamburg API Items in Database');

$techicalUser = ImporterHelper::getTechnicalUser('hamburg-technical');
$items = HamburgRSSItem::whereNull('imported_at')->get();
$items = HamburgRSSItem::all();

foreach ($items as $item) {
$item->createEvent($techicalUser);
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Importers/Leipzig.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function handle(): void

$techicalUser = ImporterHelper::getTechnicalUser('leipzig-technical');

$items = LeipzigRSSItem::whereNull('imported_at')->get();
$items = LeipzigRSSItem::all();

foreach ($items as $item) {

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Importers/Muensterland.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function handle(): void

$techicalUser = ImporterHelper::getTechnicalUser('muensterland-technical');

$items = MuensterlandRSSItem::whereNull('imported_at')->get();
$items = MuensterlandRSSItem::all();

foreach ($items as $item) {

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Importers/Niedersachsen.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function handle(): void

$technicalUser = ImporterHelper::getTechnicalUser('niedersachsen-technical');

$items = NiedersachsenRSSItem::whereNull('imported_at')->get();
$items = NiedersachsenRSSItem::all();

foreach ($items as $item) {

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Importers/Nordhessen.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function handle(): void

$techicalUser = ImporterHelper::getTechnicalUser('nordhessen-technical');

$items = NordhessenRSSItem::whereNull('imported_at')->get();
$items = NordhessenRSSItem::all();

foreach ($items as $item) {

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Importers/Thueringen.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function handle(): void

$techicalUser = ImporterHelper::getTechnicalUser('thueringen-technical');

$items = ThueringenRSSItem::whereNull('imported_at')->get();
$items = ThueringenRSSItem::all();

foreach ($items as $item) {

Expand Down
93 changes: 93 additions & 0 deletions app/Console/Commands/SyncBlogs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php

namespace App\Console\Commands;

use App\Blog;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;

class SyncBlogs extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:sync-blogs';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Fetch blogs from an API and store them in the database';

/**
* Execute the console command.
*/
public function handle()
{
$url = config('codeweek.blog_url') . '/wp-json/wp/v2/posts';
$perPage = 10;
$page = 1;

try {
do {
$response = Http::get("{$url}?per_page={$perPage}&page={$page}");

if (!$response->successful()) {
$this->error("Failed to fetch data from API: {$url}?per_page={$perPage}&page={$page}");
break;
}

$data = $response->json();
$totalPages = $response->header('X-WP-TotalPages', 1);

foreach ($data as $item) {
Blog::updateOrCreate(
['path' => $item['link']],
[
'name' => data_get($item, 'title.rendered', ''),
'categories' => json_encode($item['categories']),
'tags' => json_encode($item['tags']),
'description' => strip_tags(data_get($item, 'excerpt.rendered', '')),
'content' => data_get($item, 'content.rendered', ''),
'thumbnail' => $this->fetchThumbnail(data_get($item, '_links.wp:featuredmedia', [])),
'path' => $item['link'],
'date' => $item['date'],
'modified' => $item['modified'],
'status' => $item['status'],
'type' => $item['type'],
'slug' => $item['slug'],
]
);
}

$this->info("Page {$page} synchronized.");
$page++;
} while ($page <= $totalPages);

$this->info('Blogs synchronized successfully!');
} catch (\Exception $e) {
Log::error("Error syncing blogs: {$e->getMessage()}");
$this->error("Error: {$e->getMessage()}");
}
}

private function fetchThumbnail($mediaLinks)
{
if (!empty($mediaLinks) && isset($mediaLinks[0]['href'])) {
try {
$mediaResponse = Http::get($mediaLinks[0]['href']);
if ($mediaResponse->successful()) {
return data_get($mediaResponse->json(), 'source_url', '');
}
} catch (\Exception $e) {
Log::error("Failed to fetch media data: {$e->getMessage()}");
}
}

return null;
}
}
3 changes: 2 additions & 1 deletion app/Console/Commands/api/GermanTraits.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private function createRSSItem($json, $city): void
private function createGermanEvent($city): void
{
$user = User::where(['email' => $this->user_email])->first();

if ($user == null) {

//Create user
Expand Down Expand Up @@ -151,4 +151,5 @@ private function createGermanEvent($city): void
$event->tags()->sync($tagsArray);
}
}

}
Loading
Loading