+ Once you make the Share Public you just need to get the ID of the sheet.
+ It is the long string like this "1Joj-iYc95wV-TFrBo_v_8bOX77QZP247EX1ot5sQGfs"
+
+
+
+
+
+
+
+
+ This is the name in the bottom tab. Capitalization counts.
+
+
+
diff --git a/routes/web.php b/routes/web.php
index 11e62888..9c36f504 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -360,3 +360,22 @@ function () {
}
);
});
+Route::middleware([
+ 'auth:sanctum',
+ config('jetstream.auth_session'),
+ 'verified',
+])->group(function () {
+ Route::controller(\App\Http\Controllers\Sources\GoogleSheetSourceController::class)->group(
+ function () {
+ Route::get('/collections/{collection}/sources/google_sheet_source/create', 'create')
+ ->name('collections.sources.google_sheet_source.create');
+ Route::post('/collections/{collection}/sources/google_sheet_source', 'store')
+ ->name('collections.sources.google_sheet_source.store');
+ Route::get('/collections/{collection}/sources/google_sheet_source/{source}/edit', 'edit')
+ ->name('collections.sources.google_sheet_source.edit');
+ Route::put('/collections/{collection}/sources/google_sheet_source/{source}/update', 'update')
+ ->name('collections.sources.google_sheet_source.update');
+ Route::post('/sources/google_sheet_source/test_feed', 'testFeed')->name('sources.google_sheet_source.test_feed');
+ }
+ );
+});
diff --git a/tests/Feature/GoogleSheetSourceTest.php b/tests/Feature/GoogleSheetSourceTest.php
new file mode 100644
index 00000000..26f8cfb1
--- /dev/null
+++ b/tests/Feature/GoogleSheetSourceTest.php
@@ -0,0 +1,39 @@
+create([
+ 'slug' => 'test',
+ 'type' => SourceTypeEnum::GoogleSheetSource,
+ 'meta_data' => [
+ 'sheet_id' => '1lywLUfx3Kf7GBQRdQg6yclhVaaWUYM9BL17kfiQshvE',
+ 'sheet_name' => 'STRATEGIES',
+ ],
+ ]);
+
+ $this->assertDatabaseCount('documents', 0);
+ $data = get_fixture('google_sheets.txt', false);
+
+ GoogleSheetWrapper::shouldReceive('handle')->once()->andReturn($data);
+
+ (new GoogleSheetSource())->handle($source);
+
+ Queue::assertPushed(ProcessCSVJob::class);
+
+ }
+}
diff --git a/tests/Feature/GoogleSheetWrapperTest.php b/tests/Feature/GoogleSheetWrapperTest.php
new file mode 100644
index 00000000..4af494a5
--- /dev/null
+++ b/tests/Feature/GoogleSheetWrapperTest.php
@@ -0,0 +1,27 @@
+ Http::response(get_fixture('google_sheets.txt', false)),
+ ]);
+
+ Http::preventStrayRequests();
+
+ $results = GoogleSheetWrapper::handle('1lywLUfx3Kf7GBQRdQg6yclhVaaWUYM9BL17kfiQshvE', 'STRATEGIES', 'A1:Z10');
+
+ $this->assertNotEmpty($results);
+
+ }
+}
diff --git a/tests/Feature/Http/Controllers/GoogleSheetSourceControllerTest.php b/tests/Feature/Http/Controllers/GoogleSheetSourceControllerTest.php
new file mode 100644
index 00000000..c68f4374
--- /dev/null
+++ b/tests/Feature/Http/Controllers/GoogleSheetSourceControllerTest.php
@@ -0,0 +1,72 @@
+create();
+ $collection = Collection::factory()->create();
+ $this->assertDatabaseCount('sources', 0);
+ $response = $this->actingAs($user)
+ ->post(route('collections.sources.google_sheet_source.store', $collection), [
+ 'title' => 'Test Title',
+ 'active' => 1,
+ 'recurring' => RecurringTypeEnum::Daily->value,
+ 'details' => 'Test Details',
+ 'meta_data' => [
+ 'sheet_id' => '1lywLUfx3Kf7GBQRdQg6yclhVaaWUYM9BL17kfiQshvE',
+ 'sheet_name' => 'STRATEGIES',
+ ],
+ 'secrets' => [],
+ ])->assertSessionHasNoErrors();
+ $response->assertSessionHas('flash.banner', 'Source added successfully');
+
+ $this->assertDatabaseCount('sources', 1);
+
+ $source = Source::first();
+
+ $this->assertEquals(SourceTypeEnum::GoogleSheetSource, $source->type);
+
+ $this->assertTrue($source->active, true);
+ }
+
+ public function test_update()
+ {
+ $source = Source::factory()->create();
+
+ $user = User::factory()->create();
+
+ $this->actingAs($user)
+ ->put(route('collections.sources.google_sheet_source.update',
+ [
+ 'collection' => $source->collection->id,
+ 'source' => $source->id,
+ ]
+ ), [
+ 'title' => 'Test Title',
+ 'active' => 1,
+ 'meta_data' => [
+ 'sheet_id' => '1lywLUfx3Kf7GBQRdQg6yclhVaaWUYM9BL17kfiQshvE',
+ 'sheet_name' => 'STRATEGIES',
+ ],
+ 'recurring' => RecurringTypeEnum::Daily->value,
+ 'details' => 'Test Details',
+ ])
+ ->assertSessionHasNoErrors()
+ ->assertStatus(302);
+
+ $this->assertTrue($source->refresh()->active, true);
+ }
+}
diff --git a/tests/fixtures/google_sheets.txt b/tests/fixtures/google_sheets.txt
new file mode 100644
index 00000000..dc99a66b
--- /dev/null
+++ b/tests/fixtures/google_sheets.txt
@@ -0,0 +1,10 @@
+"CATEGORY","ORIGINAL QUESTION","RESPONSES","OTHER"
+"ABOUT THE AGENCY","AGENCY HISTORY","Sundance Solutions owner Alfred Nutile has been building Laravel Applications for 14+ years including for companies as large as Pfizer and as small as RuffTools.",""
+"ABOUT THE AGENCY","CAPABILITIES OVERVIEW","Truly full stack but more importantly your CTO who will help you clearly define your vision and goals each step of the way. Using the build, measure learn philosophy he will make sure you are building the right thing for your vision and customers and not just the next thing. It truly is a partnership",""
+"CAPABILITIES","STRATEGY","From the start your project will start with a foundation that is solid and flexible so NO TIME is wasted on the tech all of it focusing on your business goals. Using the 90-10 strategy we focus on the 10% of your idea that is the unique part and prove it works. The other 90 we most likely have it covered in our foundation Laravel Stack","We help you build the right things quickly"
+"CAPABILITIES","STRATEGY","From dashboards to user management when your needs fit Filament we use it to save time and provide for you an easy to support code base.",""
+"CAPABILITIES","STRATEGY","For the front end we focus on simplicity with Inertia and Vue. Inertia is a Laravel first class citizen and allows us to build dynamic websites without the complexity most javascript heavy applications bring to a project!",""
+"CAPABILITIES","STRATEGY","Ai and LLM integration is key in modern web applications and we have created an OpenSource tool to do just that LaraLlama.io",""
+"CAPABILITIES","COST","Sundance is only one staff member, Alfred Nutile who will work directly with you the product owner. If more team is needed it will be only after we agree and I bring in staff I have worked with before.",""
+"ABOUT THE AGENCY","HISTORY","Had a PHP Shop for 2 years then was lead Laravel contractor at Pfizer for 10 years before becoming Director the last 3 of the Laravel team and applications Alfred Nutile created for Pfizer. The past 3 years has been working with companies of all sizes to build applications for them.",""
+"CAPABILITIES","STRATEGY","Week to week day to day you will see results, we talk and build from there. No big design up front, no fixed bids to build something you do not want. Nothing like that.",""
\ No newline at end of file
diff --git a/tests/fixtures/latest_messages.json b/tests/fixtures/latest_messages.json
index db6debe9..de90c85f 100644
--- a/tests/fixtures/latest_messages.json
+++ b/tests/fixtures/latest_messages.json
@@ -1,6 +1,6 @@
[
{
- "content": "Voluptas earum qui voluptates nisi non. Cupiditate placeat sunt provident libero dolorem nihil. Consequuntur reiciendis in amet aut et qui.\n\nVoluptatem sint voluptas ratione maiores. Illum voluptatem minima iste veritatis. Dolorem totam suscipit doloremque aliquam ex dignissimos. Ut molestias officia voluptates aliquid rerum.\n\nCorporis iste totam sapiente magni voluptatem aliquam. Qui perspiciatis impedit nesciunt praesentium rerum. Ea delectus repellendus dolores atque soluta et reprehenderit. Eum saepe exercitationem non.",
+ "content": "Suscipit quod libero est eos quas eaque et. Veritatis laudantium enim magni nihil. Et provident magnam blanditiis non distinctio tempora possimus.\n\nQui reprehenderit dolor reprehenderit ex beatae enim sapiente. Sunt deleniti eos quidem repellendus magni totam at omnis. Aut est qui quia omnis dolore sed accusamus. Eius quos non dolores tenetur error minima.\n\nEt nihil eligendi exercitationem tempore placeat. In vitae rerum repellendus et deleniti porro. Repellendus nobis eum recusandae velit. Molestiae dolores quos magni quasi consequuntur.",
"role": "user",
"is_ai": false,
"show": true,
diff --git a/tests/fixtures/validated_chat_input.json b/tests/fixtures/validated_chat_input.json
index b6341fad..9e3eda97 100644
--- a/tests/fixtures/validated_chat_input.json
+++ b/tests/fixtures/validated_chat_input.json
@@ -1,8 +1,9 @@
{
"completion": false,
"tool": null,
- "input": "can you summarize this collection",
+ "input": "Can you summarize this collection for me",
"filter": null,
"persona": null,
- "date_range": null
+ "date_range": null,
+ "reference_collection_id": null
}
\ No newline at end of file