Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1500c55

Browse files
authored
Merge pull request#1383 from lowcoder-org/fix/byuser
organization/byuser endpoint issue fixed
2 parentsa55bd38 +8bfb6c1 commit1500c55

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

‎server/api-service/lowcoder-server/src/main/java/org/lowcoder/runner/migrations/DatabaseChangelog.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,32 @@ public void addTimeSeriesSnapshotHistory(MongockTemplate mongoTemplate, CommonCo
396396
makeIndex("createdAt"));
397397
}
398398

399+
@ChangeSet(order ="027",id ="populate-email-in-user-connections",author ="Thomas")
400+
publicvoidpopulateEmailInUserConnections(MongockTemplatemongoTemplate,CommonConfigcommonConfig) {
401+
Queryquery =newQuery(Criteria.where("connections.authId").is("EMAIL")
402+
.and("connections.email").is(null));
403+
404+
// Get the collection directly and use a cursor for manual iteration
405+
MongoCursor<Document>cursor =mongoTemplate.getCollection("user").find(query.getQueryObject()).iterator();
406+
407+
while (cursor.hasNext()) {
408+
Documentdocument =cursor.next();
409+
410+
// Retrieve connections array
411+
List<Document>connections = (List<Document>)document.get("connections");
412+
for (Documentconnection :connections) {
413+
if ("EMAIL".equals(connection.getString("authId")) && !connection.containsKey("email")) {
414+
// Set the email field with the value of the name field
415+
connection.put("email",connection.getString("name"));
416+
}
417+
}
418+
419+
// Save the updated document back to the collection
420+
mongoTemplate.getCollection("user").replaceOne(newDocument("_id",document.get("_id")),document);
421+
}
422+
423+
}
424+
399425

400426
privatevoidaddGidField(MongockTemplatemongoTemplate,StringcollectionName) {
401427
// Create a query to match all documents

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp