refactor: change mutable properties to immutable in data classes
This commit is contained in:
parent
586425998d
commit
6d1c03ec85
4
.idea/deploymentTargetSelector.xml
generated
4
.idea/deploymentTargetSelector.xml
generated
@ -4,10 +4,10 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2025-10-04T16:00:07.516752Z">
|
||||
<DropdownSelection timestamp="2025-10-05T02:12:09.761378Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=15947d21" />
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=6fbe7ac" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
|
||||
@ -1,11 +1,7 @@
|
||||
package com.qingshuige.tangyuan.model
|
||||
|
||||
data class Category(
|
||||
var categoryId: Int = 0,
|
||||
var baseName: String? = null,
|
||||
var baseDescription: String? = null
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return baseName!!
|
||||
}
|
||||
}
|
||||
val categoryId: Int = 0,
|
||||
val baseName: String? = null,
|
||||
val baseDescription: String? = null
|
||||
)
|
||||
|
||||
@ -3,11 +3,11 @@ package com.qingshuige.tangyuan.model
|
||||
import java.util.Date
|
||||
|
||||
data class Comment(
|
||||
var commentId: Int = 0,
|
||||
var parentCommentId: Int = 0,
|
||||
var userId: Int = 0,
|
||||
var postId: Int = 0,
|
||||
var content: String? = null,
|
||||
var imageGuid: String? = null,
|
||||
var commentDateTime: Date? = null
|
||||
val commentId: Int = 0,
|
||||
val parentCommentId: Int = 0,
|
||||
val userId: Int = 0,
|
||||
val postId: Int = 0,
|
||||
val content: String? = null,
|
||||
val imageGuid: String? = null,
|
||||
val commentDateTime: Date? = null
|
||||
)
|
||||
|
||||
@ -3,9 +3,9 @@ package com.qingshuige.tangyuan.model
|
||||
import java.util.Date
|
||||
|
||||
data class CreatPostMetadataDto(
|
||||
var isVisible: Boolean = false,
|
||||
var postDateTime: Date? = null,
|
||||
var sectionId: Int = 0,
|
||||
var categoryId: Int = 0,
|
||||
var userId: Int = 0
|
||||
val isVisible: Boolean = false,
|
||||
val postDateTime: Date? = null,
|
||||
val sectionId: Int = 0,
|
||||
val categoryId: Int = 0,
|
||||
val userId: Int = 0
|
||||
)
|
||||
|
||||
@ -3,10 +3,10 @@ package com.qingshuige.tangyuan.model
|
||||
import java.util.Date
|
||||
|
||||
data class CreateCommentDto(
|
||||
var commentDateTime: Date? = null,
|
||||
var content: String? = null,
|
||||
var imageGuid: String? = null,
|
||||
var parentCommentId: Long = 0,
|
||||
var postId: Long = 0,
|
||||
var userId: Long = 0
|
||||
val commentDateTime: Date? = null,
|
||||
val content: String? = null,
|
||||
val imageGuid: String? = null,
|
||||
val parentCommentId: Long = 0,
|
||||
val postId: Long = 0,
|
||||
val userId: Long = 0
|
||||
)
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package com.qingshuige.tangyuan.model
|
||||
|
||||
data class CreateUserDto(
|
||||
var avatarGuid: String? = null,
|
||||
var isoRegionName: String? = null,
|
||||
var nickName: String? = null,
|
||||
var password: String? = null,
|
||||
var phoneNumber: String? = null
|
||||
val avatarGuid: String? = null,
|
||||
val isoRegionName: String? = null,
|
||||
val nickName: String? = null,
|
||||
val password: String? = null,
|
||||
val phoneNumber: String? = null
|
||||
)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.qingshuige.tangyuan.model
|
||||
|
||||
data class LoginDto(
|
||||
var password: String? = null,
|
||||
var phoneNumber: String? = null
|
||||
val password: String? = null,
|
||||
val phoneNumber: String? = null
|
||||
)
|
||||
|
||||
@ -3,11 +3,11 @@ package com.qingshuige.tangyuan.model
|
||||
import java.util.Date
|
||||
|
||||
data class NewNotification(
|
||||
var notificationId: Int = 0,
|
||||
var type: String? = null,
|
||||
var targetUserId: Int = 0,
|
||||
var sourceId: Int = 0,
|
||||
var sourceType: String? = null,
|
||||
var isRead: Boolean = false,
|
||||
var createDate: Date? = null
|
||||
val notificationId: Int = 0,
|
||||
val type: String? = null,
|
||||
val targetUserId: Int = 0,
|
||||
val sourceId: Int = 0,
|
||||
val sourceType: String? = null,
|
||||
val isRead: Boolean = false,
|
||||
val createDate: Date? = null
|
||||
)
|
||||
|
||||
@ -3,12 +3,12 @@ package com.qingshuige.tangyuan.model
|
||||
import java.util.Date
|
||||
|
||||
data class Notification(
|
||||
var notificationId: Int = 0,
|
||||
var targetUserId: Int = 0,
|
||||
var targetPostId: Int = 0,
|
||||
var targetCommentId: Int = 0,
|
||||
var sourceCommentId: Int = 0,
|
||||
var sourceUserId: Int = 0,
|
||||
var isRead: Boolean = false,
|
||||
var notificationDateTime: Date? = null
|
||||
val notificationId: Int = 0,
|
||||
val targetUserId: Int = 0,
|
||||
val targetPostId: Int = 0,
|
||||
val targetCommentId: Int = 0,
|
||||
val sourceCommentId: Int = 0,
|
||||
val sourceUserId: Int = 0,
|
||||
val isRead: Boolean = false,
|
||||
val notificationDateTime: Date? = null
|
||||
)
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package com.qingshuige.tangyuan.model
|
||||
|
||||
data class PostBody(
|
||||
var postId: Int = 0,
|
||||
var textContent: String? = null,
|
||||
var image1UUID: String? = null,
|
||||
var image2UUID: String? = null,
|
||||
var image3UUID: String? = null
|
||||
val postId: Int = 0,
|
||||
val textContent: String? = null,
|
||||
val image1UUID: String? = null,
|
||||
val image2UUID: String? = null,
|
||||
val image3UUID: String? = null
|
||||
)
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
package com.qingshuige.tangyuan.model
|
||||
|
||||
data class User(
|
||||
var userId: Int = 0,
|
||||
var nickName: String = "",
|
||||
var phoneNumber: String = "",
|
||||
var isoRegionName: String = "",
|
||||
var email: String = "",
|
||||
var bio: String = "",
|
||||
var avatarGuid: String = "",
|
||||
var password: String = ""
|
||||
val userId: Int = 0,
|
||||
val nickName: String = "",
|
||||
val phoneNumber: String = "",
|
||||
val isoRegionName: String = "",
|
||||
val email: String = "",
|
||||
val bio: String = "",
|
||||
val avatarGuid: String = "",
|
||||
val password: String = ""
|
||||
)
|
||||
@ -16,10 +16,10 @@ class JwtAuthenticator(private val tm: TokenManager, private val baseUrl: String
|
||||
@Throws(IOException::class)
|
||||
override fun authenticate(route: Route?, response: Response): Request? {
|
||||
// 创建登录请求体
|
||||
val loginDto = LoginDto().apply {
|
||||
val loginDto = LoginDto(
|
||||
password = tm.password,
|
||||
phoneNumber = tm.phoneNumber
|
||||
password = tm.password
|
||||
}
|
||||
)
|
||||
|
||||
val json = gson.toJson(loginDto)
|
||||
val requestBody = json.toRequestBody(mediaType)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user