Nantes Université

Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider e770e30c rédigé par Féry Mathieu (Mathius)'s avatar Féry Mathieu (Mathius)
Parcourir les fichiers

feat(identifiers): Add default identifiers if not alredy taken

parent 099fb4b0
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Pipeline #34154 réussi
......@@ -41,7 +41,8 @@ public class Post implements WithAncestor<User> {
}
public Post(@NonNull PostContent content, @NonNull User author) {
this(null, content.uri, content.msg, content.title, new Date(), author, new ArrayList<>());
this(content.title != null ? String.format("%s-%s", author.getId(), content.title) : null, content.uri,
content.msg, content.title, new Date(), author, new ArrayList<>());
}
public String getId() {
......
......@@ -47,7 +47,7 @@ public class User implements WithIdentifier {
@JsonCreator
public User(@NonNull @JsonProperty("userName") String userName, @NonNull @JsonProperty("email") String email,
@Nullable @JsonProperty("uri") String uri) {
this(null, userName, email, uri, new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
this(userName, userName, email, uri, new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
}
@Override
......
package fr.univnantes.webandcloud.api.core;
import java.util.UUID;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
......@@ -56,7 +54,8 @@ public class UserOAuth implements WithAncestor<User> {
* @param userIdOfProvider String represent id of user in this provider
*/
public UserOAuth(@NonNull User userRelated, @NonNull String providerNameRelated, @NonNull String userIdOfProvider) {
this(UUID.randomUUID().toString(), userRelated, providerNameRelated, userIdOfProvider);
this(String.format("%s-%s", userRelated.getId(), providerNameRelated), userRelated, providerNameRelated,
userIdOfProvider);
}
/**
......@@ -81,7 +80,7 @@ public class UserOAuth implements WithAncestor<User> {
*/
public UserOAuth(@NonNull User userRelated, @NonNull OAuthProvider providerRelated,
@NonNull String userIdOfProvider) {
this(UUID.randomUUID().toString(), userRelated, providerRelated, userIdOfProvider);
this(userRelated, providerRelated.nameProvider, userIdOfProvider);
}
/**
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter