Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Andrew Biryukov
Flutter
Commits
f97eb088
Commit
f97eb088
authored
Jul 04, 2022
by
Andrew Biryukov
Browse files
add sql script
parent
321f0f25
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/Auth/auth.dart
View file @
f97eb088
...
...
@@ -4,8 +4,8 @@ import 'package:supabase_flutter/supabase_flutter.dart';
Future
<
GotrueSessionResponse
>
signUpUser
(
String
email
,
String
password
,
int
age
,
String
city
,
String
info
)
async
{
final
user
=
await
Supabase
.
instance
.
client
.
auth
.
signUp
(
email
,
password
);
final
response
=
await
Supabase
.
instance
.
client
.
from
(
'
U
ser
D
ata'
)
.
insert
([
{
"user_id"
:
user
.
user
?.
id
,
"
A
ge"
:
age
,
"
C
ity"
:
city
,
"
I
nfo"
:
info
}
final
response
=
await
Supabase
.
instance
.
client
.
from
(
'
u
ser
d
ata'
)
.
insert
([
{
"user_id"
:
user
.
user
?.
id
,
"
a
ge"
:
age
,
"
c
ity"
:
city
,
"
i
nfo"
:
info
}
])
.
execute
();
print
(
response
.
error
);
...
...
lib/Pages/User.dart
View file @
f97eb088
...
...
@@ -104,13 +104,13 @@ class _UserPageState extends State<UserPage> {
Future
<
void
>
getUserAge
()
async
{
var
curUserId
=
Supabase
.
instance
.
client
.
auth
.
user
()
?.
id
;
final
response
=
await
Supabase
.
instance
.
client
.
from
(
'
U
ser
D
ata'
)
.
select
(
'
A
ge'
)
.
from
(
'
u
ser
d
ata'
)
.
select
(
'
a
ge'
)
.
eq
(
'user_id'
,
curUserId
)
.
execute
();
if
(
mounted
)
{
// check whether the state object is in tree
setState
(()
{
_userAge
=
response
.
data
[
0
][
'
A
ge'
];
_userAge
=
response
.
data
[
0
][
'
a
ge'
];
});
}
}
...
...
@@ -118,13 +118,13 @@ class _UserPageState extends State<UserPage> {
Future
<
void
>
getUserCity
()
async
{
var
curUserId
=
Supabase
.
instance
.
client
.
auth
.
user
()
?.
id
;
final
response
=
await
Supabase
.
instance
.
client
.
from
(
'
U
ser
D
ata'
)
.
select
(
'
C
ity'
)
.
from
(
'
u
ser
d
ata'
)
.
select
(
'
c
ity'
)
.
eq
(
'user_id'
,
curUserId
)
.
execute
();
if
(
mounted
)
{
setState
(()
{
_userCity
=
response
.
data
[
0
][
'
C
ity'
];
_userCity
=
response
.
data
[
0
][
'
c
ity'
];
});
}
}
...
...
@@ -132,13 +132,13 @@ class _UserPageState extends State<UserPage> {
Future
<
void
>
getUserInfo
()
async
{
var
curUserId
=
Supabase
.
instance
.
client
.
auth
.
user
()
?.
id
;
final
response
=
await
Supabase
.
instance
.
client
.
from
(
'
U
ser
D
ata'
)
.
select
(
'
I
nfo'
)
.
from
(
'
u
ser
d
ata'
)
.
select
(
'
i
nfo'
)
.
eq
(
'user_id'
,
curUserId
)
.
execute
();
if
(
mounted
)
{
setState
(()
{
_userInfo
=
response
.
data
[
0
][
'
I
nfo'
];
_userInfo
=
response
.
data
[
0
][
'
i
nfo'
];
});
}
}
...
...
supabase/migrations/UserData.sql
0 → 100644
View file @
f97eb088
create
table
UserData
(
user_id
uuid
primary
key
,
Age
int
,
City
text
,
Info
text
);
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment