diff --git a/crud.py b/crud.py index a8e2f76..9650ae6 100644 --- a/crud.py +++ b/crud.py @@ -120,10 +120,10 @@ async def create_participant( async def get_participant( - raisenow_id: str, req: Optional[Request] = None + participant_id: str, req: Optional[Request] = None ) -> Optional[Participant]: row = await db.fetchone( - "SELECT * FROM raisenow.participants WHERE id = ?", (raisenow_id,) + "SELECT * FROM raisenow.participants WHERE id = ?", (participant_id,) ) if not row: return None @@ -136,14 +136,11 @@ async def get_participant( async def get_participants( - wallet_ids: Union[str, List[str]], req: Optional[Request] = None + raisenow_id: str, req: Optional[Request] = None ) -> List[Participant]: - if isinstance(wallet_ids, str): - wallet_ids = [wallet_ids] - q = ",".join(["?"] * len(wallet_ids)) rows = await db.fetchall( - f"SELECT * FROM raisenow.participants WHERE wallet IN ({q})", (*wallet_ids,) + "SELECT * FROM raisenow.participants WHERE raisenow = ?", (raisenow_id,) ) tempRows = [Participant(**row) for row in rows] if req: diff --git a/migrations.py b/migrations.py index 04cce6d..f0b1b4b 100644 --- a/migrations.py +++ b/migrations.py @@ -30,7 +30,7 @@ async def m002_initial(db): """ CREATE TABLE raisenow.participants ( id TEXT PRIMARY KEY, - raise TEXT NOT NULL, + raisenow TEXT NOT NULL, name TEXT NOT NULL, description TEXT, profile_image TEXT, diff --git a/templates/raisenow/index.html b/templates/raisenow/index.html index 5bec0da..fc3d34a 100644 --- a/templates/raisenow/index.html +++ b/templates/raisenow/index.html @@ -41,7 +41,7 @@
raisenow
color="accent" round dense - @click="props.expand = !props.expand" + @click="handleClick(props.key, props)" :icon="props.expand ? 'expand_less' : 'expand_more'" >Participants @@ -85,14 +85,6 @@
raisenow
class="float-left q-my-sm" >Add Participant - Delete All @@ -215,10 +207,8 @@
{{SITE_TITLE}} raisenow extension
placeholder="Name for your raise"> - + placeholder="Optional profile image URL 400/400px">
Update raisenow {{SITE_TITLE}} raisenow extension console.log(this.RaiseFormDialog.data.live_dates) const data = { name: this.RaiseFormDialog.data.name, - description: this.RaiseFormDialog.data.description, - background_image: this.RaiseFormDialog.data.background_image, - header_image: this.RaiseFormDialog.data.header_image, - live_dates: String(this.RaiseFormDialog.data.live_dates.from + ',' + this.RaiseFormDialog.data.live_dates.to) + description: this.RaiseFormDialog.data.description + } + if(this.RaiseFormDialog.data.live_dates){ + data.live_dates = String(this.RaiseFormDialog.data.live_dates.from + ',' + this.RaiseFormDialog.data.live_dates.to) + } + if(this.RaiseFormDialog.data.background_image){ + data.background_image = this.RaiseFormDialog.data.background_image + } + if(this.RaiseFormDialog.data.header_image){ + data.header_image = this.RaiseFormDialog.data.header_image } + const wallet = _.findWhere(this.g.user.wallets, { id: this.RaiseFormDialog.data.wallet }) @@ -493,7 +490,7 @@
{{SITE_TITLE}} raisenow extension
LNbits.api .request( 'GET', - '/participants/api/v1/' + raID, + '/raisenow/api/v1/participants/' + raID, this.g.user.wallets[0].inkey ) .then(function (response) { @@ -503,9 +500,9 @@
{{SITE_TITLE}} raisenow extension
}) }) }, - openParticipantDialog: function (id) { + openParticipantDialog: function (raId) { this.ParticpantsFormDialog.data = { - raisenow: id + raisenow: raId } this.ParticpantsFormDialog.show = true }, @@ -564,6 +561,11 @@
{{SITE_TITLE}} raisenow extension
return obj.raisenow == partId }) }, + handleClick(id, props) { + console.log(id) + this.getparticipants(id) + props.expand = !props.expand + }, makeItRain: function () { document.getElementById("vue").disabled = true var end = Date.now() + (2 * 1000) diff --git a/views_api.py b/views_api.py index 35ff946..9139b40 100644 --- a/views_api.py +++ b/views_api.py @@ -26,6 +26,11 @@ delete_raisenow, get_raisenow, get_raisenows, + create_participant, + update_participant, + delete_participant, + get_participant, + get_participants, ) from .models import CreateRaiseNowData, CreateParticipantData, Participant, RaiseNow