feat: collection rename #4
@@ -19,7 +19,7 @@ import type {
|
||||
CollectionInterface,
|
||||
} from '../types/collection';
|
||||
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
|
||||
@@ -94,6 +94,9 @@ export const collectionService = {
|
||||
* @returns Promise with created collection object
|
||||
*/
|
||||
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);
|
||||
return createCollectionObject(response);
|
||||
},
|
||||
@@ -106,6 +109,9 @@ export const collectionService = {
|
||||
* @returns Promise with updated collection object
|
||||
*/
|
||||
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);
|
||||
return createCollectionObject(response);
|
||||
},
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
import { ref, computed, readonly } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import { collectionService } from '../services'
|
||||
import { CollectionObject } from '../models/collection'
|
||||
import type { SourceSelector, ListFilter, ListSort, CollectionMutableProperties } from '../types'
|
||||
import { CollectionObject, CollectionPropertiesObject } from '../models/collection'
|
||||
import type { SourceSelector, ListFilter, ListSort } from '../types'
|
||||
|
||||
export const useCollectionsStore = defineStore('mailCollectionsStore', () => {
|
||||
// State
|
||||
@@ -221,7 +221,7 @@ export const useCollectionsStore = defineStore('mailCollectionsStore', () => {
|
||||
*
|
||||
* @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
|
||||
try {
|
||||
const response = await collectionService.create({
|
||||
@@ -255,7 +255,7 @@ export const useCollectionsStore = defineStore('mailCollectionsStore', () => {
|
||||
*
|
||||
* @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
|
||||
try {
|
||||
const response = await collectionService.update({
|
||||
|
||||
Reference in New Issue
Block a user