Added basic bookmarks
This commit is contained in:
parent
d55e4bb203
commit
fd534bfae7
8
.wundergraph/operations/getBookmarks.graphql
Normal file
8
.wundergraph/operations/getBookmarks.graphql
Normal file
@ -0,0 +1,8 @@
|
||||
query Bookmarks {
|
||||
directus_bookmarks {
|
||||
id
|
||||
name
|
||||
url
|
||||
tags
|
||||
}
|
||||
}
|
@ -5,6 +5,9 @@ type Query {
|
||||
todos(filter: todos_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [todos!]!
|
||||
todos_by_id(id: ID!): todos
|
||||
todos_aggregated(groupBy: [String], filter: todos_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [todos_aggregated!]!
|
||||
bookmarks(filter: bookmarks_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [bookmarks!]!
|
||||
bookmarks_by_id(id: ID!): bookmarks
|
||||
bookmarks_aggregated(groupBy: [String], filter: bookmarks_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [bookmarks_aggregated!]!
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
@ -12,16 +15,23 @@ type Mutation {
|
||||
create_projects_item(data: create_projects_input!): projects
|
||||
create_todos_items(filter: todos_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [create_todos_input!]): [todos!]!
|
||||
create_todos_item(data: create_todos_input!): todos
|
||||
create_bookmarks_items(filter: bookmarks_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [create_bookmarks_input!]): [bookmarks!]!
|
||||
create_bookmarks_item(data: create_bookmarks_input!): bookmarks
|
||||
update_projects_items(filter: projects_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, ids: [ID]!, data: update_projects_input!): [projects!]!
|
||||
update_projects_batch(filter: projects_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [update_projects_input!]): [projects!]!
|
||||
update_projects_item(id: ID!, data: update_projects_input!): projects
|
||||
update_todos_items(filter: todos_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, ids: [ID]!, data: update_todos_input!): [todos!]!
|
||||
update_todos_batch(filter: todos_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [update_todos_input!]): [todos!]!
|
||||
update_todos_item(id: ID!, data: update_todos_input!): todos
|
||||
update_bookmarks_items(filter: bookmarks_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, ids: [ID]!, data: update_bookmarks_input!): [bookmarks!]!
|
||||
update_bookmarks_batch(filter: bookmarks_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String, data: [update_bookmarks_input!]): [bookmarks!]!
|
||||
update_bookmarks_item(id: ID!, data: update_bookmarks_input!): bookmarks
|
||||
delete_projects_items(ids: [ID]!): delete_many
|
||||
delete_projects_item(id: ID!): delete_one
|
||||
delete_todos_items(ids: [ID]!): delete_many
|
||||
delete_todos_item(id: ID!): delete_one
|
||||
delete_bookmarks_items(ids: [ID]!): delete_many
|
||||
delete_bookmarks_item(id: ID!): delete_one
|
||||
}
|
||||
|
||||
type Subscription {
|
||||
@ -44,6 +54,7 @@ type Subscription {
|
||||
directus_users_mutated(event: EventEnum): directus_users_mutated
|
||||
directus_shares_mutated(event: EventEnum): directus_shares_mutated
|
||||
directus_webhooks_mutated(event: EventEnum): directus_webhooks_mutated
|
||||
bookmarks_mutated(event: EventEnum): bookmarks_mutated
|
||||
}
|
||||
|
||||
"""The `Boolean` scalar type represents `true` or `false`."""
|
||||
@ -92,6 +103,58 @@ enum EventEnum {
|
||||
delete
|
||||
}
|
||||
|
||||
type bookmarks {
|
||||
id: ID!
|
||||
status: String
|
||||
sort: Int
|
||||
user_created(filter: directus_users_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): directus_users
|
||||
date_created: Date
|
||||
date_created_func: datetime_functions
|
||||
user_updated(filter: directus_users_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): directus_users
|
||||
date_updated: Date
|
||||
date_updated_func: datetime_functions
|
||||
url: String
|
||||
name: String
|
||||
tags: JSON
|
||||
tags_func: count_functions
|
||||
}
|
||||
|
||||
type bookmarks_aggregated {
|
||||
group: JSON
|
||||
countAll: Int
|
||||
count: bookmarks_aggregated_count
|
||||
countDistinct: bookmarks_aggregated_count
|
||||
avg: bookmarks_aggregated_fields
|
||||
sum: bookmarks_aggregated_fields
|
||||
avgDistinct: bookmarks_aggregated_fields
|
||||
sumDistinct: bookmarks_aggregated_fields
|
||||
min: bookmarks_aggregated_fields
|
||||
max: bookmarks_aggregated_fields
|
||||
}
|
||||
|
||||
type bookmarks_aggregated_count {
|
||||
id: Int
|
||||
status: Int
|
||||
sort: Int
|
||||
user_created: Int
|
||||
date_created: Int
|
||||
user_updated: Int
|
||||
date_updated: Int
|
||||
url: Int
|
||||
name: Int
|
||||
tags: Int
|
||||
}
|
||||
|
||||
type bookmarks_aggregated_fields {
|
||||
sort: Float
|
||||
}
|
||||
|
||||
type bookmarks_mutated {
|
||||
key: ID!
|
||||
event: EventEnum
|
||||
data: bookmarks
|
||||
}
|
||||
|
||||
type count_functions {
|
||||
count: Int
|
||||
}
|
||||
@ -602,6 +665,24 @@ type todos_mutated {
|
||||
data: todos
|
||||
}
|
||||
|
||||
input bookmarks_filter {
|
||||
id: string_filter_operators
|
||||
status: string_filter_operators
|
||||
sort: number_filter_operators
|
||||
user_created: directus_users_filter
|
||||
date_created: date_filter_operators
|
||||
date_created_func: datetime_function_filter_operators
|
||||
user_updated: directus_users_filter
|
||||
date_updated: date_filter_operators
|
||||
date_updated_func: datetime_function_filter_operators
|
||||
url: string_filter_operators
|
||||
name: string_filter_operators
|
||||
tags: string_filter_operators
|
||||
tags_func: count_function_filter_operators
|
||||
_and: [bookmarks_filter]
|
||||
_or: [bookmarks_filter]
|
||||
}
|
||||
|
||||
input boolean_filter_operators {
|
||||
_eq: Boolean
|
||||
_neq: Boolean
|
||||
@ -613,6 +694,19 @@ input count_function_filter_operators {
|
||||
count: number_filter_operators
|
||||
}
|
||||
|
||||
input create_bookmarks_input {
|
||||
id: ID
|
||||
status: String
|
||||
sort: Int
|
||||
user_created: create_directus_users_input
|
||||
date_created: Date
|
||||
user_updated: create_directus_users_input
|
||||
date_updated: Date
|
||||
url: String
|
||||
name: String
|
||||
tags: JSON
|
||||
}
|
||||
|
||||
input create_directus_files_input {
|
||||
id: ID
|
||||
storage: String!
|
||||
@ -992,6 +1086,19 @@ input todos_filter {
|
||||
_or: [todos_filter]
|
||||
}
|
||||
|
||||
input update_bookmarks_input {
|
||||
id: ID
|
||||
status: String
|
||||
sort: Int
|
||||
user_created: update_directus_users_input
|
||||
date_created: Date
|
||||
user_updated: update_directus_users_input
|
||||
date_updated: Date
|
||||
url: String
|
||||
name: String
|
||||
tags: JSON
|
||||
}
|
||||
|
||||
input update_directus_files_input {
|
||||
id: ID
|
||||
storage: String
|
||||
|
@ -4,7 +4,6 @@ import operations from './wundergraph.operations';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import dotenv from 'dotenv';
|
||||
import axios from 'axios';
|
||||
dotenv.config();
|
||||
|
||||
const directusSchema = fs.readFileSync(path.join(path.resolve(), './schemas/directus.graphql'), 'utf8');
|
||||
|
@ -6,6 +6,7 @@
|
||||
<li><a href="/me">Dashboard</a></li>
|
||||
<li><a href="/me/projects">My Projects</a></li>
|
||||
<li><a href="/me/banking">Banking</a></li>
|
||||
<li><a href="/me/bookmarks">Bookmarks</a></li>
|
||||
<li><a href="/me/acc">Access Control</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
40
src/routes/me/bookmarks/+page.svelte
Normal file
40
src/routes/me/bookmarks/+page.svelte
Normal file
@ -0,0 +1,40 @@
|
||||
<script lang="ts">
|
||||
import HeaderMain from "$lib/layouts/HeaderMain.svelte";
|
||||
import { createQuery } from "../../../lib/wundergraph";
|
||||
|
||||
const bookmarksQuery = createQuery({
|
||||
operationName: "getBookmarks",
|
||||
});
|
||||
</script>
|
||||
|
||||
<HeaderMain>
|
||||
<div slot="header">
|
||||
<h1>Bookmarks</h1>
|
||||
</div>
|
||||
|
||||
<div slot="main">
|
||||
<div class="w-full h-full overflow-y-auto">
|
||||
<div class="w-full h-full results">
|
||||
{#if $bookmarksQuery.isLoading}
|
||||
<p>Loading...</p>
|
||||
{:else if $bookmarksQuery.error}
|
||||
<pre>Error: {JSON.stringify($bookmarksQuery.error, null, 2)}</pre>
|
||||
{:else}
|
||||
{#each $bookmarksQuery.data.directus_bookmarks as bookmark (bookmark.id)}
|
||||
<a href={bookmark.url} class="text-blue-500 hover:underline">
|
||||
{bookmark.name}
|
||||
</a>
|
||||
<div class="mt-2">
|
||||
{#each bookmark.tags as tag (tag)}
|
||||
<span
|
||||
class="inline-block bg-blue-200 text-blue-800 px-2 py-1 rounded-full mr-2 mb-2"
|
||||
>{tag}</span
|
||||
>
|
||||
{/each}
|
||||
</div>
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</HeaderMain>
|
Loading…
Reference in New Issue
Block a user