From ce61e2143a358d6c187b6c3473ab114c60ab4724 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 30 Jun 2024 23:55:11 +0300 Subject: Import JPA entities from 2018 --- src/main/java/com/juick/data/EntityUtils.java | 39 +++++++ .../java/com/juick/data/MessagesRepository.java | 24 ++++ src/main/java/com/juick/data/UsersRepository.java | 40 +++++++ .../data/entities/BaseMessagePropertyEntity.java | 34 ++++++ .../data/entities/BaseUserPropertyEntity.java | 34 ++++++ .../java/com/juick/data/entities/EmailEntity.java | 37 ++++++ .../com/juick/data/entities/FacebookEntity.java | 37 ++++++ .../java/com/juick/data/entities/LoginEntity.java | 36 ++++++ .../com/juick/data/entities/MessageEntity.java | 99 ++++++++++++++++ .../java/com/juick/data/entities/ReplyEntity.java | 48 ++++++++ .../java/com/juick/data/entities/TagEntity.java | 32 ++++++ .../com/juick/data/entities/TagNameEntity.java | 47 ++++++++ .../com/juick/data/entities/TelegramEntity.java | 37 ++++++ .../java/com/juick/data/entities/TextEntity.java | 42 +++++++ .../java/com/juick/data/entities/UserEntity.java | 126 +++++++++++++++++++++ .../java/com/juick/data/entities/VKEntity.java | 37 ++++++ 16 files changed, 749 insertions(+) create mode 100644 src/main/java/com/juick/data/EntityUtils.java create mode 100644 src/main/java/com/juick/data/MessagesRepository.java create mode 100644 src/main/java/com/juick/data/UsersRepository.java create mode 100644 src/main/java/com/juick/data/entities/BaseMessagePropertyEntity.java create mode 100644 src/main/java/com/juick/data/entities/BaseUserPropertyEntity.java create mode 100644 src/main/java/com/juick/data/entities/EmailEntity.java create mode 100644 src/main/java/com/juick/data/entities/FacebookEntity.java create mode 100644 src/main/java/com/juick/data/entities/LoginEntity.java create mode 100644 src/main/java/com/juick/data/entities/MessageEntity.java create mode 100644 src/main/java/com/juick/data/entities/ReplyEntity.java create mode 100644 src/main/java/com/juick/data/entities/TagEntity.java create mode 100644 src/main/java/com/juick/data/entities/TagNameEntity.java create mode 100644 src/main/java/com/juick/data/entities/TelegramEntity.java create mode 100644 src/main/java/com/juick/data/entities/TextEntity.java create mode 100644 src/main/java/com/juick/data/entities/UserEntity.java create mode 100644 src/main/java/com/juick/data/entities/VKEntity.java (limited to 'src/main/java/com/juick') diff --git a/src/main/java/com/juick/data/EntityUtils.java b/src/main/java/com/juick/data/EntityUtils.java new file mode 100644 index 00000000..9f3a9f11 --- /dev/null +++ b/src/main/java/com/juick/data/EntityUtils.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data; + +import com.juick.model.User; +import com.juick.data.entities.UserEntity; + +class EntityUtils { + static User entityToUser(UserEntity entity) { + User user = new User(); + user.setUid(entity.getId()); + user.setName(entity.getName()); + user.setBanned(entity.isBanned()); + return user; + } + static User entityToSecurityUser(UserEntity entity) { + User user = new User(); + user.setUid(entity.getId()); + user.setName(entity.getName()); + user.setBanned(entity.isBanned()); + user.setCredentials(entity.getPassword()); + return user; + } +} diff --git a/src/main/java/com/juick/data/MessagesRepository.java b/src/main/java/com/juick/data/MessagesRepository.java new file mode 100644 index 00000000..8207ffcb --- /dev/null +++ b/src/main/java/com/juick/data/MessagesRepository.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data; + +import com.juick.data.entities.MessageEntity; +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface MessagesRepository extends PagingAndSortingRepository { +} diff --git a/src/main/java/com/juick/data/UsersRepository.java b/src/main/java/com/juick/data/UsersRepository.java new file mode 100644 index 00000000..64e08192 --- /dev/null +++ b/src/main/java/com/juick/data/UsersRepository.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data; + +import com.juick.data.entities.UserEntity; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import java.util.Collection; +import java.util.Optional; +import java.util.stream.Stream; + +@Repository +public interface UsersRepository extends CrudRepository { + Optional findById(Integer uid); + Optional findByName(String name); + Optional findByNameAndPassword(String name, String password); + Optional findByEmailsEmail(String email); + Stream findAllByNameIn(Collection names); + Stream findAllByIdIn(Collection uids); + Optional findByFacebookIds_FacebookId(Long facebookId); + Optional findByVkIds_VkId(Long vkId); + Optional findByLogins_Hash(String hash); + Optional findByTgIds_Identifier(Long telegramId); +} diff --git a/src/main/java/com/juick/data/entities/BaseMessagePropertyEntity.java b/src/main/java/com/juick/data/entities/BaseMessagePropertyEntity.java new file mode 100644 index 00000000..934cce92 --- /dev/null +++ b/src/main/java/com/juick/data/entities/BaseMessagePropertyEntity.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; + +@MappedSuperclass +public class BaseMessagePropertyEntity { + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "message_id") + private MessageEntity message; + public MessageEntity getMessage() { + return message; + } + + public void setMessage(MessageEntity message) { + this.message = message; + } +} diff --git a/src/main/java/com/juick/data/entities/BaseUserPropertyEntity.java b/src/main/java/com/juick/data/entities/BaseUserPropertyEntity.java new file mode 100644 index 00000000..0397c409 --- /dev/null +++ b/src/main/java/com/juick/data/entities/BaseUserPropertyEntity.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; + +@MappedSuperclass +public class BaseUserPropertyEntity { + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "user_id") + private UserEntity user; + public UserEntity getUser() { + return user; + } + + public void setUser(UserEntity user) { + this.user = user; + } +} diff --git a/src/main/java/com/juick/data/entities/EmailEntity.java b/src/main/java/com/juick/data/entities/EmailEntity.java new file mode 100644 index 00000000..566a9654 --- /dev/null +++ b/src/main/java/com/juick/data/entities/EmailEntity.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; + +@Entity +@Table(name = "emails") +public class EmailEntity extends BaseUserPropertyEntity { + @Id + @Column(name = "email", columnDefinition = "char(64)") + @GeneratedValue(strategy = GenerationType.AUTO) + private String email; + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } +} diff --git a/src/main/java/com/juick/data/entities/FacebookEntity.java b/src/main/java/com/juick/data/entities/FacebookEntity.java new file mode 100644 index 00000000..75bee8d8 --- /dev/null +++ b/src/main/java/com/juick/data/entities/FacebookEntity.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; + +@Entity +@Table(name = "facebook") +public class FacebookEntity extends BaseUserPropertyEntity { + @Id + @Column(name = "fb_id", columnDefinition = "bigint(20)") + @GeneratedValue(strategy = GenerationType.AUTO) + private Long facebookId; + + public Long getFacebookId() { + return facebookId; + } + + public void setFacebookId(Long facebookId) { + this.facebookId = facebookId; + } +} diff --git a/src/main/java/com/juick/data/entities/LoginEntity.java b/src/main/java/com/juick/data/entities/LoginEntity.java new file mode 100644 index 00000000..69737b5d --- /dev/null +++ b/src/main/java/com/juick/data/entities/LoginEntity.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; + +@Entity +@Table(name = "logins") +public class LoginEntity extends BaseUserPropertyEntity { + @Id + @Column(name = "hash", columnDefinition = "char(16)") + private String hash; + + public String getHash() { + return hash; + } + + public void setHash(String hash) { + this.hash = hash; + } +} diff --git a/src/main/java/com/juick/data/entities/MessageEntity.java b/src/main/java/com/juick/data/entities/MessageEntity.java new file mode 100644 index 00000000..8fa751c9 --- /dev/null +++ b/src/main/java/com/juick/data/entities/MessageEntity.java @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; +import java.io.Serializable; +import java.time.Instant; +import java.util.HashSet; +import java.util.Set; + +@Entity +@Table(name = "messages") +public class MessageEntity implements Serializable { + @Id + @Column(name = "message_id", columnDefinition = "int(10) unsigned not null auto_increment") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "message") + private Set tags = new HashSet<>(); + @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "message") + private Set replies = new HashSet<>(); + + @OneToOne(cascade = CascadeType.ALL) + @PrimaryKeyJoinColumn + private TextEntity textEntity; + + @ManyToOne(cascade = CascadeType.ALL) + private UserEntity user; + + @Column(name = "ts") + private Instant ts; + + public MessageEntity() { + this.textEntity = new TextEntity(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Set getTags() { + return tags; + } + + public void setTags(Set tags) { + this.tags = tags; + } + + public Set getReplies() { + return replies; + } + + public void setReplies(Set replies) { + this.replies = replies; + } + + public String getText() { + return textEntity.getText(); + } + + public void setText(String text) { + this.textEntity.setText(text); + } + + public UserEntity getUser() { + return user; + } + + public void setUser(UserEntity user) { + this.user = user; + } + + public Instant getTimestamp() { + return ts; + } + + public void setTimestamp(Instant ts) { + this.ts = ts; + } +} diff --git a/src/main/java/com/juick/data/entities/ReplyEntity.java b/src/main/java/com/juick/data/entities/ReplyEntity.java new file mode 100644 index 00000000..102d9848 --- /dev/null +++ b/src/main/java/com/juick/data/entities/ReplyEntity.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; + +@Entity +@Table(name = "replies") +public class ReplyEntity extends BaseMessagePropertyEntity { + @Id + @Column(name = "reply_id", columnDefinition = "smallint") + @GeneratedValue(strategy = GenerationType.AUTO) + private Long replyId; + @Column(name = "txt", columnDefinition = "clob") + private + String text; + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public Long getReplyId() { + return replyId; + } + + public void setReplyId(Long replyId) { + this.replyId = replyId; + } +} diff --git a/src/main/java/com/juick/data/entities/TagEntity.java b/src/main/java/com/juick/data/entities/TagEntity.java new file mode 100644 index 00000000..5dddb074 --- /dev/null +++ b/src/main/java/com/juick/data/entities/TagEntity.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; + +@Entity +@Table(name = "messages_tags") +public class TagEntity extends BaseMessagePropertyEntity { + @Id + @Column(name = "tag_id", columnDefinition = "int(10)") + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + @OneToOne(cascade = CascadeType.ALL) + @PrimaryKeyJoinColumn + private TagNameEntity tagName; +} diff --git a/src/main/java/com/juick/data/entities/TagNameEntity.java b/src/main/java/com/juick/data/entities/TagNameEntity.java new file mode 100644 index 00000000..96bcea8e --- /dev/null +++ b/src/main/java/com/juick/data/entities/TagNameEntity.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; + +@Entity +@Table(name = "tags") +public class TagNameEntity { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "tag_id") + private int id; + @Column(name = "name", columnDefinition = "varchar(70)") + private String name; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/src/main/java/com/juick/data/entities/TelegramEntity.java b/src/main/java/com/juick/data/entities/TelegramEntity.java new file mode 100644 index 00000000..b5b4d8ef --- /dev/null +++ b/src/main/java/com/juick/data/entities/TelegramEntity.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; + +@Entity +@Table(name = "telegram") +public class TelegramEntity extends BaseUserPropertyEntity { + @Id + @Column(name = "tg_id", columnDefinition = "bigint(20)") + @GeneratedValue(strategy = GenerationType.AUTO) + private Long identifier; + + public Long getIdentifier() { + return identifier; + } + + public void setIdentifier(Long identifier) { + this.identifier = identifier; + } +} diff --git a/src/main/java/com/juick/data/entities/TextEntity.java b/src/main/java/com/juick/data/entities/TextEntity.java new file mode 100644 index 00000000..57a1722f --- /dev/null +++ b/src/main/java/com/juick/data/entities/TextEntity.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; +import java.io.Serializable; + +@Entity +@Table(name = "messages_txt") +public class TextEntity implements Serializable { + + @Id + @Column(name = "message_id", columnDefinition = "int(10)") + @GeneratedValue(strategy = GenerationType.AUTO) + private int id; + + @Column(name = "txt", columnDefinition = "clob") + private String text; + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } +} diff --git a/src/main/java/com/juick/data/entities/UserEntity.java b/src/main/java/com/juick/data/entities/UserEntity.java new file mode 100644 index 00000000..1984799e --- /dev/null +++ b/src/main/java/com/juick/data/entities/UserEntity.java @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; +import java.util.HashSet; +import java.util.Set; + +@Entity +@Table(name = "users") +public class UserEntity { + @Id + @Column(name = "id", columnDefinition = "int(10) unsigned not null auto_increment") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + + @Column(name = "nick", columnDefinition = "char(64)") + private String name; + + @Column(name = "passw", columnDefinition = "char(32)") + private String password; + + @Column(name = "banned", columnDefinition = "tinyint(1)") + private boolean banned; + + @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "user") + private Set emails = new HashSet<>(); + + @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "user") + private Set facebookIds = new HashSet<>(); + + @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "user") + private Set vkIds = new HashSet<>(); + + @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "user") + private Set logins = new HashSet<>(); + @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "user") + private Set tgIds = new HashSet<>(); + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Integer getId() { + return id; + } + + public void setId(Integer uid) { + this.id = uid; + } + + public boolean isBanned() { + return banned; + } + + public void setBanned(boolean banned) { + this.banned = banned; + } + + public Set getEmails() { + return emails; + } + + public void setEmails(Set emails) { + this.emails = emails; + } + + public Set getFacebookIds() { + return facebookIds; + } + + public void setFacebookIds(Set facebookIds) { + this.facebookIds = facebookIds; + } + + public Set getVkIds() { + return vkIds; + } + + public void setVkIds(Set vkIds) { + this.vkIds = vkIds; + } + + public Set getLogins() { + return logins; + } + + public void setLogins(Set logins) { + this.logins = logins; + } + + public Set getTgIds() { + return tgIds; + } + + public void setTgIds(Set tgIds) { + this.tgIds = tgIds; + } +} diff --git a/src/main/java/com/juick/data/entities/VKEntity.java b/src/main/java/com/juick/data/entities/VKEntity.java new file mode 100644 index 00000000..04aa55eb --- /dev/null +++ b/src/main/java/com/juick/data/entities/VKEntity.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008-2024, Juick + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package com.juick.data.entities; + +import jakarta.persistence.*; + +@Entity +@Table(name = "vk") +public class VKEntity extends BaseUserPropertyEntity { + @Id + @Column(name = "vk_id", columnDefinition = "bigint(20)") + @GeneratedValue(strategy = GenerationType.AUTO) + private Long vkId; + + public Long getVkId() { + return vkId; + } + + public void setVkId(Long vkId) { + this.vkId = vkId; + } +} -- cgit v1.2.3