mirror of
https://github.com/danbulant/ssps-bot
synced 2026-06-15 20:31:07 +00:00
vytváření studenta v databázi
This commit is contained in:
parent
6162fbccf4
commit
b1b82bfa5e
1 changed files with 4 additions and 2 deletions
|
|
@ -126,14 +126,16 @@ sequelize.afterBulkSync(async () => {
|
|||
|
||||
if(api.isStudentMail(user.email)) {
|
||||
if(!user.class) continue;
|
||||
user.class = user.class.replace(/ |\./, "").toUpperCase();
|
||||
user.class = user.class.replace(/ |\./g, "").toUpperCase();
|
||||
var student = await Student.findOne({
|
||||
where: {
|
||||
personId: person.id
|
||||
}
|
||||
});
|
||||
if(!student) {
|
||||
await Person.create({
|
||||
await Student.create({
|
||||
id: user.email.split("@")[0],
|
||||
classId: api.map[user.class],
|
||||
personId: person.id,
|
||||
name: person.name
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue