modify method name

This commit is contained in:
MaysWind
2025-03-23 14:59:06 +08:00
parent fc2c5a8e6c
commit ab4fc8faf5
11 changed files with 18 additions and 18 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ export class Account implements AccountInfoResponse {
return !this.visible; return !this.visible;
} }
public from(other: Account): void { public fillFrom(other: Account): void {
this.id = other.id; this.id = other.id;
this.category = other.category; this.category = other.category;
this.type = other.type; this.type = other.type;
+1 -1
View File
@@ -37,7 +37,7 @@ export class TransactionCategory implements TransactionCategoryInfoResponse {
return !this.visible; return !this.visible;
} }
public from(other: TransactionCategory): void { public fillFrom(other: TransactionCategory): void {
this.id = other.id; this.id = other.id;
this.name = other.name; this.name = other.name;
this.parentId = other.parentId; this.parentId = other.parentId;
+1 -1
View File
@@ -27,7 +27,7 @@ export class TransactionTemplate extends Transaction implements TransactionTempl
this.hidden = hidden; this.hidden = hidden;
} }
public from(other: TransactionTemplate): void { public fillFrom(other: TransactionTemplate): void {
this.templateType = other.templateType; this.templateType = other.templateType;
this.name = other.name; this.name = other.name;
+1 -1
View File
@@ -34,7 +34,7 @@ export class User {
this.firstDayOfWeek = firstDayOfWeek; this.firstDayOfWeek = firstDayOfWeek;
} }
public from(user: User | UserBasicInfo | UserProfileResponse): void { public fillFrom(user: User | UserBasicInfo | UserProfileResponse): void {
this.username = user.username; this.username = user.username;
this.email = user.email; this.email = user.email;
this.nickname = user.nickname; this.nickname = user.nickname;
@@ -139,13 +139,13 @@ export function useAccountEditPageBaseBase() {
} }
function setAccount(newAccount: Account): void { function setAccount(newAccount: Account): void {
account.value.from(newAccount); account.value.fillFrom(newAccount);
subAccounts.value = []; subAccounts.value = [];
if (newAccount.subAccounts && newAccount.subAccounts.length > 0) { if (newAccount.subAccounts && newAccount.subAccounts.length > 0) {
for (let i = 0; i < newAccount.subAccounts.length; i++) { for (let i = 0; i < newAccount.subAccounts.length; i++) {
const subAccount = account.value.createNewSubAccount(userStore.currentUserDefaultCurrency, getCurrentUnixTime()); const subAccount: Account = account.value.createNewSubAccount(userStore.currentUserDefaultCurrency, getCurrentUnixTime());
subAccount.from(newAccount.subAccounts[i]); subAccount.fillFrom(newAccount.subAccounts[i]);
subAccounts.value.push(subAccount); subAccounts.value.push(subAccount);
} }
+3 -3
View File
@@ -151,12 +151,12 @@ export function useUserProfilePageBase() {
function setCurrentUserProfile(profile: UserBasicInfo): void { function setCurrentUserProfile(profile: UserBasicInfo): void {
emailVerified.value = profile.emailVerified; emailVerified.value = profile.emailVerified;
oldProfile.value.from(profile); oldProfile.value.fillFrom(profile);
newProfile.value.from(oldProfile.value); newProfile.value.fillFrom(oldProfile.value);
} }
function reset(): void { function reset(): void {
newProfile.value.from(oldProfile.value); newProfile.value.fillFrom(oldProfile.value);
} }
function doAfterProfileUpdate(user: UserBasicInfo): void { function doAfterProfileUpdate(user: UserBasicInfo): void {
@@ -279,7 +279,7 @@ function open(options?: { id?: string, currentAccount?: Account, category?: numb
submitting.value = false; submitting.value = false;
const newAccount = Account.createNewAccount(userStore.currentUserDefaultCurrency, getCurrentUnixTime()); const newAccount = Account.createNewAccount(userStore.currentUserDefaultCurrency, getCurrentUnixTime());
account.value.from(newAccount); account.value.fillFrom(newAccount);
subAccounts.value = []; subAccounts.value = [];
currentAccountIndex.value = -1; currentAccountIndex.value = -1;
@@ -149,18 +149,18 @@ function open(options: { id?: string; parentId?: string; type?: CategoryType; cu
submitting.value = false; submitting.value = false;
const newTransactionCategory = TransactionCategory.createNewCategory(); const newTransactionCategory = TransactionCategory.createNewCategory();
category.value.from(newTransactionCategory); category.value.fillFrom(newTransactionCategory);
if (options.id) { if (options.id) {
if (options.currentCategory) { if (options.currentCategory) {
category.value.from(options.currentCategory); category.value.fillFrom(options.currentCategory);
} }
editCategoryId.value = options.id; editCategoryId.value = options.id;
transactionCategoriesStore.getCategory({ transactionCategoriesStore.getCategory({
categoryId: editCategoryId.value categoryId: editCategoryId.value
}).then(response => { }).then(response => {
category.value.from(response); category.value.fillFrom(response);
loading.value = false; loading.value = false;
}).catch(error => { }).catch(error => {
loading.value = false; loading.value = false;
@@ -718,7 +718,7 @@ function open(options: TransactionEditOptions): Promise<TransactionEditResponse
if (options && options.id) { if (options && options.id) {
if (options.currentTemplate) { if (options.currentTemplate) {
setTransaction(options.currentTemplate, options, false, false); setTransaction(options.currentTemplate, options, false, false);
(transaction.value as TransactionTemplate).from(options.currentTemplate); (transaction.value as TransactionTemplate).fillFrom(options.currentTemplate);
} }
mode.value = TransactionEditPageMode.Edit; mode.value = TransactionEditPageMode.Edit;
@@ -768,7 +768,7 @@ function open(options: TransactionEditOptions): Promise<TransactionEditResponse
transaction.value = TransactionTemplate.createNewTransactionTemplate(transaction.value); transaction.value = TransactionTemplate.createNewTransactionTemplate(transaction.value);
} }
(transaction.value as TransactionTemplate).from(template); (transaction.value as TransactionTemplate).fillFrom(template);
} else { } else {
setTransaction(null, options, true, true); setTransaction(null, options, true, true);
} }
+1 -1
View File
@@ -209,7 +209,7 @@ function init(): void {
transactionCategoriesStore.getCategory({ transactionCategoriesStore.getCategory({
categoryId: editCategoryId.value categoryId: editCategoryId.value
}).then(response => { }).then(response => {
category.value.from(response); category.value.fillFrom(response);
loading.value = false; loading.value = false;
}).catch(error => { }).catch(error => {
if (error.processed) { if (error.processed) {
+1 -1
View File
@@ -955,7 +955,7 @@ function init(): void {
transaction.value = TransactionTemplate.createNewTransactionTemplate(transaction.value); transaction.value = TransactionTemplate.createNewTransactionTemplate(transaction.value);
} }
(transaction.value as TransactionTemplate).from(template); (transaction.value as TransactionTemplate).fillFrom(template);
} }
loading.value = false; loading.value = false;