Add a clear-data endpoint
This commit is contained in:
parent
e68de31a6a
commit
06fe914fa6
@ -54,6 +54,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
$$ language plpgsql;
|
$$ language plpgsql;
|
||||||
|
|
||||||
|
create or replace function clear_user_data(p_user_id uuid)
|
||||||
|
returns void
|
||||||
|
as $$
|
||||||
|
begin
|
||||||
|
delete from staking_source where user_id = p_user_id;
|
||||||
|
delete from inventory_item where user_id = p_user_id;
|
||||||
|
update bank_account set balance = 2000 where user_id = p_user_id;
|
||||||
|
update resource_account set balance = 0 where user_id = p_user_id;
|
||||||
|
end;
|
||||||
|
$$ language plpgsql;
|
||||||
|
|
||||||
create or replace function get_staking_sources(user_id uuid)
|
create or replace function get_staking_sources(user_id uuid)
|
||||||
returns table (
|
returns table (
|
||||||
|
@ -38,29 +38,3 @@ delete from claim_event;
|
|||||||
|
|
||||||
alter table store_item alter column price type integer using price::integer;
|
alter table store_item alter column price type integer using price::integer;
|
||||||
|
|
||||||
-- Import config from google sheets
|
|
||||||
drop table test_csv_import;
|
|
||||||
|
|
||||||
create table test_csv_import (
|
|
||||||
id integer,
|
|
||||||
name text,
|
|
||||||
description text,
|
|
||||||
image text,
|
|
||||||
claimAmount int,
|
|
||||||
completionTimeInMins int,
|
|
||||||
tier1price int,
|
|
||||||
tier1claimboost int,
|
|
||||||
tier2price int,
|
|
||||||
tier2claimboost int,
|
|
||||||
tier3price int,
|
|
||||||
tier3claimboost int,
|
|
||||||
tier4price int,
|
|
||||||
tier4claimboost int,
|
|
||||||
tier5price int,
|
|
||||||
tier5claimboost int
|
|
||||||
);
|
|
||||||
|
|
||||||
\copy test_csv_import from '../storeitems.csv' delimiter ',' csv header;
|
|
||||||
|
|
||||||
select * from test_csv_import;
|
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ create table upgrade_event (
|
|||||||
inventory_item_id uuid not null,
|
inventory_item_id uuid not null,
|
||||||
created_at timestamp with time zone default timezone('utc', now()),
|
created_at timestamp with time zone default timezone('utc', now()),
|
||||||
constraint fk_iid_upgrade_event foreign key(inventory_item_id)
|
constraint fk_iid_upgrade_event foreign key(inventory_item_id)
|
||||||
references inventory_item(id)
|
references inventory_item(id) on delete cascade
|
||||||
);
|
);
|
||||||
|
|
||||||
create table staking_event (
|
create table staking_event (
|
||||||
@ -98,7 +98,7 @@ create table staking_event (
|
|||||||
constraint fk_wid_staking_event foreign key(well_id)
|
constraint fk_wid_staking_event foreign key(well_id)
|
||||||
references resource_well(id),
|
references resource_well(id),
|
||||||
constraint fk_iiid_staking_event foreign key(inventory_item_id)
|
constraint fk_iiid_staking_event foreign key(inventory_item_id)
|
||||||
references inventory_item(id)
|
references inventory_item(id) on delete cascade
|
||||||
);
|
);
|
||||||
|
|
||||||
create table claim_event (
|
create table claim_event (
|
||||||
|
@ -20,6 +20,10 @@ POST http://localhost:3000/api/user/login
|
|||||||
GET http://localhost:3000/api/user/:user_id/bank-account
|
GET http://localhost:3000/api/user/:user_id/bank-account
|
||||||
:headers
|
:headers
|
||||||
|
|
||||||
|
# Get bank account
|
||||||
|
POST http://localhost:3000/api/user/:user_id/clear-data
|
||||||
|
:headers
|
||||||
|
|
||||||
# Get bank account
|
# Get bank account
|
||||||
GET http://localhost:3000/api/leaderboards
|
GET http://localhost:3000/api/leaderboards
|
||||||
:headers
|
:headers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user