feat: add translations, update db migration
continuous-integration/drone/push Build is passing Details

create-campaign
Davide Polonio 2023-05-11 12:33:54 +02:00
parent 0169d28ffd
commit 39b673bdfd
7 changed files with 48 additions and 3 deletions

View File

@ -18,14 +18,17 @@ public class Campaign extends Base {
@NotNull @NotNull
private String name; private String name;
@Nullable @Null private String description; @Length(4096)
@Nullable
@Null
private String description;
@ManyToMany(fetch = FetchType.LAZY) @ManyToMany(fetch = FetchType.LAZY)
private List<User> users; private List<User> users;
public Campaign(String id, String campaignName, @Nullable String description) { public Campaign(String id, String name, @Nullable String description) {
this.id = id; this.id = id;
this.name = campaignName; this.name = name;
this.description = description; this.description = description;
} }

View File

@ -53,6 +53,11 @@ public class CreateCampaign implements Processor {
return Set.of(TRIGGERING_KEYWORD, "/newCampaign"); return Set.of(TRIGGERING_KEYWORD, "/newCampaign");
} }
@Override
public String getLocaleDescriptionKeyword() {
return "createCampaign.cmdDescription";
}
@Override @Override
public CompletableFuture<Optional<BaseRequest<?, ?>>> process(TgChat chat, Update update) { public CompletableFuture<Optional<BaseRequest<?, ?>>> process(TgChat chat, Update update) {
// There are multiple steps, we have to route the incoming campaign creation to the right one // There are multiple steps, we have to route the incoming campaign creation to the right one

View File

@ -8,6 +8,21 @@ create table callback_query_context (
constraint pk_callback_query_context primary key (id) constraint pk_callback_query_context primary key (id)
); );
create table campaign (
id varchar(64) not null,
name varchar(256) not null,
description varchar(4096),
entry_created timestamptz not null,
entry_modified timestamptz not null,
constraint pk_campaign primary key (id)
);
create table campaign_registered_user (
campaign_id varchar(64) not null,
registered_user_id varchar(64) not null,
constraint pk_campaign_registered_user primary key (campaign_id,registered_user_id)
);
create table telegram_chat ( create table telegram_chat (
id bigint generated by default as identity not null, id bigint generated by default as identity not null,
chat_context jsonb not null default '{}'::jsonb not null, chat_context jsonb not null default '{}'::jsonb not null,
@ -29,5 +44,23 @@ create table registered_user (
constraint pk_registered_user primary key (id) constraint pk_registered_user primary key (id)
); );
create table registered_user_campaign (
registered_user_id varchar(64) not null,
campaign_id varchar(64) not null,
constraint pk_registered_user_campaign primary key (registered_user_id,campaign_id)
);
-- foreign keys and indices -- foreign keys and indices
create index ix_campaign_registered_user_campaign on campaign_registered_user (campaign_id);
alter table campaign_registered_user add constraint fk_campaign_registered_user_campaign foreign key (campaign_id) references campaign (id) on delete restrict on update restrict;
create index ix_campaign_registered_user_registered_user on campaign_registered_user (registered_user_id);
alter table campaign_registered_user add constraint fk_campaign_registered_user_registered_user foreign key (registered_user_id) references registered_user (id) on delete restrict on update restrict;
alter table registered_user add constraint fk_registered_user_telegram_id foreign key (telegram_id) references telegram_chat (id) on delete cascade on update restrict; alter table registered_user add constraint fk_registered_user_telegram_id foreign key (telegram_id) references telegram_chat (id) on delete cascade on update restrict;
create index ix_registered_user_campaign_registered_user on registered_user_campaign (registered_user_id);
alter table registered_user_campaign add constraint fk_registered_user_campaign_registered_user foreign key (registered_user_id) references registered_user (id) on delete restrict on update restrict;
create index ix_registered_user_campaign_campaign on registered_user_campaign (campaign_id);
alter table registered_user_campaign add constraint fk_registered_user_campaign_campaign foreign key (campaign_id) references campaign (id) on delete restrict on update restrict;

View File

@ -29,3 +29,4 @@ createCampaign.creationDone=All done! I have successfully added your campaign to
createCampaign.finalCreationAction=*Finishes to write down on the scroll the last details* createCampaign.finalCreationAction=*Finishes to write down on the scroll the last details*
createCampaign.lookToPileAction=*Moves the scroll into a pile of other, disorganized, scrolls* createCampaign.lookToPileAction=*Moves the scroll into a pile of other, disorganized, scrolls*
createCampaign.shareCampaign=Now, if you want, you can share this campaign to other players so that they can join! To do this, just click on the button below and then select the user or the group you want to share this campaign with! They will be able to add their characters and see the other characters in this campaign createCampaign.shareCampaign=Now, if you want, you can share this campaign to other players so that they can join! To do this, just click on the button below and then select the user or the group you want to share this campaign with! They will be able to add their characters and see the other characters in this campaign
createCampaign.cmdDescription=Create a new DnD campaign

View File

@ -29,3 +29,4 @@ createCampaign.creationDone=All done! I have successfully added your campaign to
createCampaign.finalCreationAction=*Finishes to write down on the scroll the last details* createCampaign.finalCreationAction=*Finishes to write down on the scroll the last details*
createCampaign.lookToPileAction=*Moves the scroll into a pile of other, disorganized, scrolls* createCampaign.lookToPileAction=*Moves the scroll into a pile of other, disorganized, scrolls*
createCampaign.shareCampaign=Now, if you want, you can share this campaign to other players so that they can join! To do this, just click on the button below and then select the user or the group you want to share this campaign with! They will be able to add their characters and see the other characters in this campaign createCampaign.shareCampaign=Now, if you want, you can share this campaign to other players so that they can join! To do this, just click on the button below and then select the user or the group you want to share this campaign with! They will be able to add their characters and see the other characters in this campaign
createCampaign.cmdDescription=Create a new DnD campaign

View File

@ -21,3 +21,4 @@ help.buttonsToo=Puoi fare le stesse operazioni che faresti con i comandi elencat
help.cmdDescription=Stampa il messaggio d''aiuto help.cmdDescription=Stampa il messaggio d''aiuto
notfound.description=Mmm non sono in grado di trovare il comando {0}, sei sicuro di averlo scritto correttamente? notfound.description=Mmm non sono in grado di trovare il comando {0}, sei sicuro di averlo scritto correttamente?
notfound.howToHelp=Lascia che ti mostri cosa posso fare, scrivi /help nella chat! notfound.howToHelp=Lascia che ti mostri cosa posso fare, scrivi /help nella chat!
createCampaign.cmdDescription=Crea una nuova campagna di DnD

View File

@ -21,3 +21,4 @@ help.buttonsToo=Puoi fare le stesse operazioni che faresti con i comandi elencat
help.cmdDescription=Stampa il messaggio d''aiuto help.cmdDescription=Stampa il messaggio d''aiuto
notfound.description=Mmm non sono in grado di trovare il comando {0}, sei sicuro di averlo scritto correttamente? notfound.description=Mmm non sono in grado di trovare il comando {0}, sei sicuro di averlo scritto correttamente?
notfound.howToHelp=Lascia che ti mostri cosa posso fare, scrivi /help nella chat! notfound.howToHelp=Lascia che ti mostri cosa posso fare, scrivi /help nella chat!
createCampaign.cmdDescription=Crea una nuova campagna di DnD