[WEB-3066] refactor: replace Space Services with Services Package (#6353)

* [WEB-3066] refactor: replace Space Services with Services Package

* chore: minor improvements

* fix: type

---------

Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
Prateek Shourya 2025-01-11 15:16:11 +05:30 committed by GitHub
parent 39ca600091
commit ade4d290f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 1002 additions and 631 deletions

View file

@ -2,3 +2,4 @@ export * from "./cycle-analytics.service";
export * from "./cycle-archive.service";
export * from "./cycle-operations.service";
export * from "./cycle.service";
export * from "./sites-cycle.service";

View file

@ -0,0 +1,31 @@
// plane imports
import { API_BASE_URL } from "@plane/constants";
import { TPublicCycle } from "@plane/types";
// api service
import { APIService } from "../api.service";
/**
* Service class for managing cycles within plane sites application.
* Extends APIService to handle HTTP requests to the cycle-related endpoints.
* @extends {APIService}
* @remarks This service is only available for plane sites
*/
export class SitesCycleService extends APIService {
constructor(BASE_URL?: string) {
super(BASE_URL || API_BASE_URL);
}
/**
* Retrieves list of cycles for a specific anchor.
* @param anchor - The anchor identifier for the published entity
* @returns {Promise<TPublicCycle[]>} The list of cycles
* @throws {Error} If the request fails
*/
async list(anchor: string): Promise<TPublicCycle[]> {
return this.get(`/api/public/anchor/${anchor}/cycles/`)
.then((response) => response?.data)
.catch((error) => {
throw error?.response?.data;
});
}
}