pushing this stuff up so carter can take a look

This commit is contained in:
csawatzky 2026-03-23 14:57:23 -06:00
parent 7e79d0859b
commit a2bc841510
13 changed files with 660 additions and 184 deletions

View file

@ -25,7 +25,9 @@ export interface IPermissionAPIContext {
shareObjectByKey: (
scope: Scope,
key: string,
permissions: pond.Permission[]
permissions: pond.Permission[],
keys?: string[],
type?: string[]
) => Promise<AxiosResponse<any>>;
addShareableLink: (scope: Scope, expiration: string) => Promise<AxiosResponse<any>>;
removeShareableLink: (scope: Scope, code: string) => Promise<AxiosResponse<any>>;
@ -136,9 +138,11 @@ export default function PermissionProvider(props: PropsWithChildren<Props>) {
})
};
const shareObjectByKey = (scope: Scope, key: string, permissions: pond.Permission[]) => {
let url = pondURL("/" + scope.kind + "s/" + scope.key + "/shareByKey")
if (as) url = pondURL(`/${scope.kind}s/${scope.key}/shareByKey?as=${as}`)
const shareObjectByKey = (scope: Scope, key: string, permissions: pond.Permission[], keys?: string[], types?: string[]) => {
let url = pondURL("/" + scope.kind + "s/" + scope.key + "/shareByKey") + (keys ? "?keys=" + keys.join(",") : "") +
(types ? "&types=" + types.join(",") : "")
if (as) url = pondURL(`/${scope.kind}s/${scope.key}/shareByKey?as=${as}`) + (keys ? "&keys=" + keys.join(",") : "") +
(types ? "&types=" + types.join(",") : "")
return new Promise<AxiosResponse>((resolve, reject) => {
post(url, {
key: key,

View file

@ -6,7 +6,7 @@ import { createContext, PropsWithChildren, useContext } from "react";
import { pondURL } from "./pond";
export interface ITaskAPIContext {
addTask: (task: pond.TaskSettings, otherTeam?: string) => Promise<AxiosResponse<pond.AddTaskResponse>>;
addTask: (task: pond.TaskSettings, otherTeam?: string, keys?: string[], types?: string[]) => Promise<AxiosResponse<pond.AddTaskResponse>>;
getTask: (taskID: string, otherTeam?: string) => Promise<AxiosResponse<pond.Task>>;
listTasks: (
limit: number,
@ -17,7 +17,9 @@ export interface ITaskAPIContext {
asRoot?: boolean,
otherTeam?: string,
from?: string,
to?: string
to?: string,
keys?: string[],
types?: string[]
) => Promise<AxiosResponse<pond.ListTasksResponse>>;
removeTask: (taskID: string, otherTeam?: string) => Promise<AxiosResponse<pond.RemoveTaskResponse>>;
updateTask: (
@ -38,10 +40,20 @@ export default function TaskProvider(props: PropsWithChildren<Props>) {
const { get, del, post, put } = useHTTP();
const [{ as }] = useGlobalState();
const addTask = (task: pond.TaskSettings, otherTeam?: string) => {
const addTask = (task: pond.TaskSettings, otherTeam?: string, keys?: string[], types?: string[]) => {
const view = otherTeam ? otherTeam : as
if (view) return post<pond.AddTaskResponse>(pondURL("/tasks?as=" + view), task);
return post<pond.AddTaskResponse>(pondURL("/tasks"), task);
if (view) return post<pond.AddTaskResponse>(
pondURL(
"/tasks?as=" + view +
(keys ? "&keys=" + keys.join(",") : "") +
(types ? "&types=" + types.join(",") : "")
), task);
return post<pond.AddTaskResponse>(
pondURL(
"/tasks" +
(keys ? "?keys=" + keys.join(",") : "") +
(types ? "&types=" + types.join(",") : "")
), task);
};
const getTask = (taskID: string, otherTeam?: string) => {
@ -65,7 +77,9 @@ export default function TaskProvider(props: PropsWithChildren<Props>) {
asRoot?: boolean,
otherTeam?: string,
from?: string,
to?: string
to?: string,
keys?: string[],
types?: string[]
) => {
const view = otherTeam ? otherTeam : as
return get<pond.ListTasksResponse>(
@ -81,7 +95,9 @@ export default function TaskProvider(props: PropsWithChildren<Props>) {
(asRoot ? "&asRoot=" + asRoot.toString() : "") +
(view ? "&as=" + view : "") +
(from ? "&from=" + from : "") +
(to ? "&to=" + to : "")
(to ? "&to=" + to : "") +
(keys ? "&keys=" + keys.join(",") : "") +
(types ? "&types=" + types.join(",") : "")
)
);
};

View file

@ -32,7 +32,7 @@ export interface ITeamAPIContext {
prefixSearch?: string,
) => Promise<AxiosResponse<pond.ListTeamsResponse>>;
listAllTeams: () => Promise<AxiosResponse<pond.ListTeamsResponse>>;
listObjectTeams: (scope: Scope, otherTeam?: string) => Promise<any>;
listObjectTeams: (scope: Scope, otherTeam?: string, keys?: string[], types?: string[]) => Promise<any>;
removeTeam: (key: string) => Promise<AxiosResponse<pond.RemoveTeamResponse>>;
}
@ -156,10 +156,12 @@ export default function TeamProvider(props: PropsWithChildren<Props>) {
})
};
const listObjectTeams = (scope: Scope, otherTeam?: string) => {
let url = "/" + scope.kind + "s/" + scope.key + "/teams"
const listObjectTeams = (scope: Scope, otherTeam?: string, keys?: string[], types?: string[]) => {
let url = "/" + scope.kind + "s/" + scope.key + "/teams" + (keys ? "?keys=" + keys.join(",") : "") +
(types ? "&types=" + types.join(",") : "")
const view = otherTeam ? otherTeam : as
if (view) url = `/${scope.kind}s/${scope.key}/teams?as=${view}`
if (view) url = `/${scope.kind}s/${scope.key}/teams?as=${view}` + (keys ? "&keys=" + keys.join(",") : "") +
(types ? "&types=" + types.join(",") : "")
return new Promise<AxiosResponse>((resolve, reject) => {
get(pondURL(url)).then(resp => {
return resolve(resp)