Skip to content

Commit

Permalink
add: default context with flow
Browse files Browse the repository at this point in the history
  • Loading branch information
danimaniarqsoft committed Apr 10, 2024
1 parent 813d268 commit 6293b09
Showing 1 changed file with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.github.danimaniarqsoft.config.dbmigrations;

import com.github.danimaniarqsoft.domain.Contexto;

import com.github.danimaniarqsoft.domain.Mensaje;
import com.github.mongobee.changeset.ChangeLog;
import com.github.mongobee.changeset.ChangeSet;

import java.util.ArrayList;
import java.util.List;

import org.springframework.data.mongodb.core.MongoTemplate;

/**
Expand All @@ -22,6 +25,23 @@ public void addContext(MongoTemplate mongoTemplate) {
contexto.setDescEn("Default context");
contexto.setNombre("default context");
contexto.setOrganizacion("Kbase");
contexto.setMensajes(defaultMessageList());
mongoTemplate.save(contexto);
}

private static List<Mensaje> defaultMessageList(){
List<Mensaje> messages = new ArrayList<>();
messages.add(createMessage("Bienvenido a $ORGANIZACION","Welcome to $ORGANIZACION", 1));
messages.add(createMessage("Este es un flujo demo para el contexto por default","This is a demo flow", 2));
messages.add(createMessage("Configura estos flujos desde la consola del kbase","Config this dialog into the kbase", 3));
return messages;
}

private static Mensaje createMessage(String desc, String descEn, Integer order){
Mensaje message = new Mensaje();
message.setDesc(desc);
message.setDescEn(descEn);
message.setOrden(order);
return message;
}
}

0 comments on commit 6293b09

Please sign in to comment.