diff --git a/api/src/main/kotlin/com/andr3h3nriqu3s/applications/ApplicationsController.kt b/api/src/main/kotlin/com/andr3h3nriqu3s/applications/ApplicationsController.kt index f6bf192..a2b64e1 100644 --- a/api/src/main/kotlin/com/andr3h3nriqu3s/applications/ApplicationsController.kt +++ b/api/src/main/kotlin/com/andr3h3nriqu3s/applications/ApplicationsController.kt @@ -32,6 +32,7 @@ data class Application( var company: String, var recruiter: String, var message: String, + var linked_application: String, var flairs: List, var views: List, ) { @@ -50,6 +51,7 @@ data class Application( rs.getString("company"), rs.getString("recruiter"), rs.getString("message"), + rs.getString("linked_application"), emptyList(), emptyList(), ) @@ -179,6 +181,7 @@ class ApplicationsController( "", "", "", + "", emptyList(), emptyList(), ) @@ -463,7 +466,7 @@ class ApplicationService( } db.update( - "insert into applications (id, url, original_url, unique_url, title, user_id, extra_data, payrange, status, company, recruiter, message) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", + "insert into applications (id, url, original_url, unique_url, title, user_id, extra_data, payrange, status, company, recruiter, message, linked_application) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", application.id, application.url, application.original_url, @@ -476,6 +479,7 @@ class ApplicationService( application.company, application.recruiter, application.message, + application.linked_application, ) return true @@ -491,6 +495,17 @@ class ApplicationService( .toList() } + // If it's to apply also remove the linked_application to only show the main + if (info.status == 0) { + return db.query( + "select * from applications where user_id=? and linked_application='' and status=0 order by title asc;", + arrayOf(user.id), + Application + ) + .toList() + } + + return db.query( "select * from applications where user_id=? and status=? order by title asc;", arrayOf(user.id, info.status), @@ -501,7 +516,7 @@ class ApplicationService( public fun update(application: Application): Application { db.update( - "update applications set url=?, original_url=?, unique_url=?, title=?, user_id=?, extra_data=?, payrange=?, status=?, company=?, recruiter=?, message=? where id=?", + "update applications set url=?, original_url=?, unique_url=?, title=?, user_id=?, extra_data=?, payrange=?, status=?, company=?, recruiter=?, message=?, linked_application=? where id=?", application.url, application.original_url, application.unique_url, @@ -513,6 +528,7 @@ class ApplicationService( application.company, application.recruiter, application.message, + application.linked_application, application.id, ) return application diff --git a/api/src/main/resources/schema.sql b/api/src/main/resources/schema.sql index 7f47b3f..d670a74 100644 --- a/api/src/main/resources/schema.sql +++ b/api/src/main/resources/schema.sql @@ -12,17 +12,18 @@ CREATE TABLE IF NOT EXISTS tokens ( ); create table if not exists applications ( - id text primary key, - url text not null, - original_url text, - unique_url text, - company text, - recruiter text, - title text, - mesasge text default '', - user_id text, - extra_data text, - status integer + id text primary key, + url text not null, + original_url text, + unique_url text, + company text, + recruiter text, + title text, + mesasge text default '', + user_id text, + extra_data text, + status integer, + linked_application text default '' ); create table if not exists views ( diff --git a/site/src/lib/ApplicationsStore.svelte.ts b/site/src/lib/ApplicationsStore.svelte.ts index 047e8b9..3198321 100644 --- a/site/src/lib/ApplicationsStore.svelte.ts +++ b/site/src/lib/ApplicationsStore.svelte.ts @@ -40,8 +40,9 @@ export type Application = { status: number; recruiter: string; company: string; - flairs: Flair[]; message: string; + linked_application: string; + flairs: Flair[]; views: View[]; }; diff --git a/site/src/routes/work-area/LinkApplication.svelte b/site/src/routes/work-area/LinkApplication.svelte new file mode 100644 index 0000000..057fe7e --- /dev/null +++ b/site/src/routes/work-area/LinkApplication.svelte @@ -0,0 +1,79 @@ + + + +
+ +
+ {applications.length} +
+
+
+ {#each applications.filter((i) => { + if (!filter) { + return true; + } + const f = new RegExp(filter, 'ig'); + + let x = i.title; + + if (i.company) { + x = `${x} @ ${i.company}`; + } + + return x.match(f); + }) as item} +
+ +
+ {/each} +
+
diff --git a/site/src/routes/work-area/WorkArea.svelte b/site/src/routes/work-area/WorkArea.svelte index babe89f..6ab5a63 100644 --- a/site/src/routes/work-area/WorkArea.svelte +++ b/site/src/routes/work-area/WorkArea.svelte @@ -13,11 +13,13 @@ import NewUrlDialog from './NewUrlDialog.svelte'; import DropZone from './DropZone.svelte'; import { userStore } from '$lib/UserStore.svelte'; + import LinkApplication from './LinkApplication.svelte'; let activeItem: Application | undefined = $state(); let extractTokens: HTMLDialogElement; let changeUrl: HTMLDialogElement; + let linkApplication: HTMLDialogElement; let lastExtData: any = $state(undefined); let autoExtData = false; @@ -268,29 +270,28 @@ onchange={save} /> -
(drag = false)} - onmouseleave={() => (drag = true)} - class="max-w-full min-w-0 overflow-hidden" - > +
Url
{activeItem.url}
- {#if activeItem.unique_url} -
(drag = false)} - onmouseleave={() => (drag = true)} - > + {#if activeItem.unique_url && activeItem.unique_url !== activeItem.url} +
Unique Url
{activeItem.unique_url}
{/if} + {#if activeItem.linked_application} +
+
Linked Application
+
+ {activeItem.linked_application} +
+
+ {/if}
Tags
@@ -342,6 +343,7 @@ Open +
@@ -363,9 +365,14 @@ Update Url {/if} +
+ {#if activeItem.original_url != null} {/if} +
{#if applicationStore.dragging} @@ -462,3 +469,11 @@ onreload={(item) => (activeItem = item)} /> {/if} + +{#if activeItem} + (activeItem = item)} + /> +{/if}