Skip to content

Commit c635109

Browse files
committed
feat(playground): improve playground
1 parent 2f1e302 commit c635109

13 files changed

Lines changed: 92 additions & 80 deletions

File tree

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
CREATE MIGRATION m1axchg2g3dqbqj3762e34ypgx6ndkiyr6fpl2niu2elb3d3kr5nfq
1+
CREATE MIGRATION m1nsxvycfjoyjrxdeejwuuovtufkpjn3vxqg3hsxfxrvwcicxtquya
22
ONTO initial
33
{
44
CREATE EXTENSION pgcrypto VERSION '1.3';
55
CREATE EXTENSION auth VERSION '1.0';
6+
67
CREATE TYPE default::User {
78
CREATE REQUIRED LINK identity: ext::auth::Identity;
89
CREATE REQUIRED PROPERTY name: std::str;
910
};
11+
1012
CREATE GLOBAL default::current_user := (std::assert_single((SELECT
1113
default::User {
1214
id,
@@ -15,12 +17,29 @@ CREATE MIGRATION m1axchg2g3dqbqj3762e34ypgx6ndkiyr6fpl2niu2elb3d3kr5nfq
1517
FILTER
1618
(.identity = GLOBAL ext::auth::ClientTokenIdentity)
1719
)));
20+
1821
CREATE TYPE default::BlogPost {
19-
CREATE REQUIRED LINK author: default::User;
22+
CREATE REQUIRED LINK author: default::User {
23+
SET default := (GLOBAL default::current_user);
24+
};
2025
CREATE ACCESS POLICY author_has_full_access
2126
ALLOW ALL USING ((.author ?= GLOBAL default::current_user));
2227
CREATE ACCESS POLICY others_read_only
2328
ALLOW SELECT ;
24-
CREATE REQUIRED PROPERTY text: std::str;
29+
CREATE PROPERTY content: std::str {
30+
SET default := 'My super blog post.';
31+
};
32+
CREATE PROPERTY description: std::str {
33+
SET default := 'My blog post description.';
34+
};
35+
CREATE PROPERTY title: std::str {
36+
SET default := 'My blog super blog post title.';
37+
};
38+
};
39+
40+
ALTER TYPE default::User {
41+
CREATE MULTI LINK posts: default::BlogPost {
42+
ON SOURCE DELETE DELETE TARGET;
43+
};
2544
};
2645
};

playground/dbschema/migrations/00002.edgeql

Lines changed: 0 additions & 22 deletions
This file was deleted.

playground/dbschema/migrations/00003.edgeql

Lines changed: 0 additions & 9 deletions
This file was deleted.

playground/dbschema/migrations/00004.edgeql

Lines changed: 0 additions & 9 deletions
This file was deleted.

playground/pages/auth/forgot-password.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
type="email"
1515
:value="email"
1616
placeholder="your@email.com"
17-
@change="(e) => updateEmail(e.target.value)"
17+
@change="(e: any) => updateEmail(e.target.value)"
1818
/>
1919
</UFormGroup>
2020
</div>
2121

2222
<template #footer>
2323
<UButton
2424
type="button"
25+
color="gray"
2526
:loading="loading"
2627
@click="(e) => submit()"
2728
>

playground/pages/auth/login.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@
1515
type="email"
1616
:value="email"
1717
placeholder="your@email.com"
18-
@change="(e) => updateEmail(e.target.value)"
18+
@change="(e: any) => updateEmail(e.target.value)"
19+
@keyup.enter="() => submit()"
1920
/>
2021
</UFormGroup>
2122
<UFormGroup label="Password">
2223
<UInput
2324
type="password"
2425
:value="password"
2526
placeholder="password"
26-
@change="(e) => updatePassword(e.target.value)"
27+
@change="(e: any) => updatePassword(e.target.value)"
28+
@keyup.enter="() => submit()"
2729
/>
2830
</UFormGroup>
2931
</div>
@@ -32,8 +34,9 @@
3234
<div class="flex items-center gap-2">
3335
<UButton
3436
type="button"
37+
color="gray"
3538
:loading="loading"
36-
@click="(e) => submit()"
39+
@click="() => submit()"
3740
>
3841
Login
3942
</UButton>

playground/pages/auth/reset-password.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@
1414
type="password"
1515
:value="password"
1616
placeholder="your@email.com"
17-
@change="(e) => updatePassword(e.target.value)"
17+
@change="(e: any) => updatePassword(e.target.value)"
1818
/>
1919
</UFormGroup>
2020
</div>
2121

2222
<template #footer>
2323
<UButton
2424
type="button"
25+
color="gray"
2526
:loading="loading"
26-
@click="(e) => submit()"
27+
@click="() => submit()"
2728
>
2829
Send reset email
2930
</UButton>

playground/pages/auth/signup.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,28 @@
1414
type="email"
1515
:value="email"
1616
placeholder="your@email.com"
17-
@change="(e) => updateEmail(e.target.value)"
17+
@change="(e: any) => updateEmail(e.target.value)"
18+
@keyup.enter="() => submit()"
1819
/>
1920
</UFormGroup>
2021
<UFormGroup label="Password">
2122
<UInput
2223
type="password"
2324
:value="password"
2425
placeholder="password"
25-
@change="(e) => updatePassword(e.target.value)"
26+
@change="(e: any) => updatePassword(e.target.value)"
27+
@keyup.enter="() => submit()"
2628
/>
2729
</UFormGroup>
2830
</div>
2931

3032
<template #footer>
3133
<div class="flex items-center gap-2">
3234
<UButton
35+
color="gray"
3336
type="button"
3437
:loading="loading"
35-
@click="(e) => submit()"
38+
@click="() => submit()"
3639
>
3740
Signup
3841
</UButton>

playground/pages/auth/verify.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<template #header>
99
<h2>Email verification</h2>
1010
</template>
11-
<UButton :loading="loading">
11+
<UButton :loading="loading" color="gray">
1212
Loading...
1313
</UButton>
1414
</UCard>

playground/pages/blogposts/[id].vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ const { data: blogpost } = await useAsyncData<BlogPost>(
2323

2424
<template #footer>
2525
<NuxtLink to="/">
26-
<UButton>Home</UButton>
26+
<UButton color="gray">
27+
Home
28+
</UButton>
2729
</NuxtLink>
2830
</template>
2931
</UCard>

0 commit comments

Comments
 (0)