mirror of
https://github.com/emo2007/block-accounting.git
synced 2025-01-18 15:36:27 +00:00
tmp
This commit is contained in:
parent
2a249e3979
commit
2ab2cf61ed
@ -131,8 +131,10 @@ func (s *Server) buildRouter() {
|
|||||||
r.Put("/", nil) // todo
|
r.Put("/", nil) // todo
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// open invite link
|
||||||
|
r.Get("/invite/{hash}", s.handle(nil, "invite_open"))
|
||||||
// join via invite link
|
// join via invite link
|
||||||
r.Post("/invite/{hash}", s.handle(s.controllers.Auth.JoinWithInvite, "invite_join"))
|
r.Post("/invite/{hash}/join", s.handle(s.controllers.Auth.JoinWithInvite, "invite_join"))
|
||||||
|
|
||||||
r.Route("/participants", func(r chi.Router) {
|
r.Route("/participants", func(r chi.Router) {
|
||||||
r.Get("/", s.handle(s.controllers.Participants.List, "participants_list"))
|
r.Get("/", s.handle(s.controllers.Participants.List, "participants_list"))
|
||||||
|
22
backend/internal/pkg/models/models.go
Normal file
22
backend/internal/pkg/models/models.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Multisig struct {
|
||||||
|
ID uuid.UUID
|
||||||
|
Title string
|
||||||
|
OrganizationID uuid.UUID
|
||||||
|
Owners []OrganizationParticipant
|
||||||
|
ConfirmationsRequired int
|
||||||
|
}
|
||||||
|
|
||||||
|
type MultisigConfirmation struct {
|
||||||
|
MultisigID uuid.UUID
|
||||||
|
Owner OrganizationParticipant
|
||||||
|
CreatedAt time.Time
|
||||||
|
UpdatedAt time.Time
|
||||||
|
}
|
@ -138,23 +138,26 @@ create table contracts (
|
|||||||
id uuid primary key,
|
id uuid primary key,
|
||||||
title varchar(250) default 'New Contract',
|
title varchar(250) default 'New Contract',
|
||||||
description text not null,
|
description text not null,
|
||||||
|
|
||||||
address bytea not null,
|
address bytea not null,
|
||||||
|
|
||||||
payload bytea not null,
|
payload bytea not null,
|
||||||
|
|
||||||
created_by uuid not null references users(id),
|
created_by uuid not null references users(id),
|
||||||
organization_id uuid not null references organizations(id),
|
organization_id uuid not null references organizations(id),
|
||||||
|
|
||||||
status smallint default 0,
|
status smallint default 0,
|
||||||
tx_index bytea default null,
|
tx_index bytea default null,
|
||||||
|
multisig bytea default null,
|
||||||
created_at timestamp default current_timestamp,
|
created_at timestamp default current_timestamp,
|
||||||
updated_at timestamp default current_timestamp
|
updated_at timestamp default current_timestamp
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create intex if not exists idx_contracts_organization_id_multisig
|
||||||
|
on contracts (organization_id, multisig);
|
||||||
|
|
||||||
|
create intex if not exists idx_contracts_organization_id_created_by
|
||||||
|
on contracts (organization_id, created_by);
|
||||||
|
|
||||||
create table multisigs (
|
create table multisigs (
|
||||||
id uuid primary key,
|
id uuid primary key,
|
||||||
|
organization_id uuid not null references organizations(id),
|
||||||
title varchar(350) default 'New Multi-Sig'
|
title varchar(350) default 'New Multi-Sig'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -166,9 +169,29 @@ create table multisig_owners (
|
|||||||
primary key (multisig_id, owner_id)
|
primary key (multisig_id, owner_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create intex if not exists idx_multisig_owners_multisig_id
|
||||||
|
on multisig_owners (multisig_id);
|
||||||
|
|
||||||
|
create intex if not exists idx_multisig_owners_owner_id
|
||||||
|
on multisig_owners (owner_id);
|
||||||
|
|
||||||
create table multisig_confirmations (
|
create table multisig_confirmations (
|
||||||
multisig_id uuid references multisigs(id),
|
multisig_id uuid references multisigs(id),
|
||||||
owner_id uuid references users(id),
|
owner_id uuid references users(id),
|
||||||
created_at timestamp default current_timestamp,
|
created_at timestamp default current_timestamp,
|
||||||
primary key (multisig_id, owner_id)
|
primary key (multisig_id, owner_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
create intex if not exists idx_multisig_confirmations_owners_multisig_id
|
||||||
|
on multisig_confirmations (multisig_id);
|
||||||
|
|
||||||
|
create intex if not exists idx_multisig_confirmations_owners_owner_id
|
||||||
|
on multisig_confirmations (owner_id);
|
||||||
|
|
||||||
|
create table invites (
|
||||||
|
link_hash bytea primary key,
|
||||||
|
created_by uuid not null references users(id),
|
||||||
|
created_at timestamp default current_timestamp,
|
||||||
|
expired_at timestamp default null,
|
||||||
|
used_at timestamp default null
|
||||||
);
|
);
|
Loading…
Reference in New Issue
Block a user