Merge pull request 'feat: collection rename' (#4) from feat/collection-rename into main

Reviewed-on: #4
This commit was merged in pull request #4.
This commit is contained in:
2026-02-16 02:32:56 +00:00
2 changed files with 13 additions and 7 deletions

View File

@@ -19,7 +19,7 @@ import type {
CollectionInterface, CollectionInterface,
} from '../types/collection'; } from '../types/collection';
import { useIntegrationStore } from '@KTXC/stores/integrationStore'; import { useIntegrationStore } from '@KTXC/stores/integrationStore';
import { CollectionObject } from '../models'; import { CollectionObject, CollectionPropertiesObject } from '../models/collection';
/** /**
* Helper to create the right collection model class based on provider identifier * Helper to create the right collection model class based on provider identifier
@@ -94,6 +94,9 @@ export const collectionService = {
* @returns Promise with created collection object * @returns Promise with created collection object
*/ */
async create(request: CollectionCreateRequest): Promise<CollectionObject> { async create(request: CollectionCreateRequest): Promise<CollectionObject> {
if (request.properties instanceof CollectionPropertiesObject) {
request.properties = request.properties.toJson();
}
const response = await transceivePost<CollectionCreateRequest, CollectionCreateResponse>('collection.create', request); const response = await transceivePost<CollectionCreateRequest, CollectionCreateResponse>('collection.create', request);
return createCollectionObject(response); return createCollectionObject(response);
}, },
@@ -106,6 +109,9 @@ export const collectionService = {
* @returns Promise with updated collection object * @returns Promise with updated collection object
*/ */
async update(request: CollectionUpdateRequest): Promise<CollectionObject> { async update(request: CollectionUpdateRequest): Promise<CollectionObject> {
if (request.properties instanceof CollectionPropertiesObject) {
request.properties = request.properties.toJson();
}
const response = await transceivePost<CollectionUpdateRequest, CollectionUpdateResponse>('collection.update', request); const response = await transceivePost<CollectionUpdateRequest, CollectionUpdateResponse>('collection.update', request);
return createCollectionObject(response); return createCollectionObject(response);
}, },

View File

@@ -5,8 +5,8 @@
import { ref, computed, readonly } from 'vue' import { ref, computed, readonly } from 'vue'
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { collectionService } from '../services' import { collectionService } from '../services'
import { CollectionObject } from '../models/collection' import { CollectionObject, CollectionPropertiesObject } from '../models/collection'
import type { SourceSelector, ListFilter, ListSort, CollectionMutableProperties } from '../types' import type { SourceSelector, ListFilter, ListSort } from '../types'
export const useCollectionsStore = defineStore('mailCollectionsStore', () => { export const useCollectionsStore = defineStore('mailCollectionsStore', () => {
// State // State
@@ -221,7 +221,7 @@ export const useCollectionsStore = defineStore('mailCollectionsStore', () => {
* *
* @returns Promise with created collection object * @returns Promise with created collection object
*/ */
async function create(provider: string, service: string | number, collection: string | number | null, data: CollectionMutableProperties): Promise<CollectionObject> { async function create(provider: string, service: string | number, collection: string | number | null, data: CollectionPropertiesObject): Promise<CollectionObject> {
transceiving.value = true transceiving.value = true
try { try {
const response = await collectionService.create({ const response = await collectionService.create({
@@ -255,7 +255,7 @@ export const useCollectionsStore = defineStore('mailCollectionsStore', () => {
* *
* @returns Promise with updated collection object * @returns Promise with updated collection object
*/ */
async function update(provider: string, service: string | number, identifier: string | number, data: CollectionMutableProperties): Promise<CollectionObject> { async function update(provider: string, service: string | number, identifier: string | number, data: CollectionPropertiesObject): Promise<CollectionObject> {
transceiving.value = true transceiving.value = true
try { try {
const response = await collectionService.update({ const response = await collectionService.update({