Skip to content

Commit

Permalink
Merge pull request #54 from fluentci-io/feat/delete-project
Browse files Browse the repository at this point in the history
feat(graphql): add queries for deleting and archiving projects
  • Loading branch information
tsirysndr authored Jul 4, 2024
2 parents 4deded8 + 87bdd04 commit f632510
Show file tree
Hide file tree
Showing 8 changed files with 212 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ Requirements:

**Latest (Desktop):**

- `Mac`: arm64: [fluentci-studio_v0.1.5_arm64.dmg](https://github.com/fluentci-io/fluentci-studio/releases/download/v0.1.5/fluentci-studio_v0.1.5_arm64.dmg) intel: [fluentci-studio_v0.1.5_x64.dmg](https://github.com/fluentci-io/fluentci-studio/releases/download/v0.1.5/fluentci-studio_v0.1.5_x64.dmg)
- `Linux`: [fluentci-studio_v0.1.5.AppImage](https://github.com/fluentci-io/fluentci-studio/releases/download/v0.1.5/fluentci-studio_v0.1.5.AppImage)
- `Mac`: arm64: [fluentci-studio_v0.1.6_arm64.dmg](https://github.com/fluentci-io/fluentci-studio/releases/download/v0.1.6/fluentci-studio_v0.1.6_arm64.dmg) intel: [fluentci-studio_v0.1.6_x64.dmg](https://github.com/fluentci-io/fluentci-studio/releases/download/v0.1.6/fluentci-studio_v0.1.6_x64.dmg)
- `Linux`: [fluentci-studio_v0.1.6.AppImage](https://github.com/fluentci-io/fluentci-studio/releases/download/v0.1.6/fluentci-studio_v0.1.6.AppImage)

**Latest (CLI):**

- `Mac`: arm64: [fluentci_v0.15.0_aarch64-apple-darwin.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.15.0/fluentci_v0.15.0_aarch64-apple-darwin.tar.gz) intel: [fluentci_v0.15.0_x86_64-apple-darwin.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.15.0/fluentci_v0.15.0_x86_64-apple-darwin.tar.gz)
- `Linux`: intel: [fluentci_v0.15.0_x86_64-unknown-linux-gnu.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.15.0/fluentci_v0.15.0_x86_64-unknown-linux-gnu.tar.gz) arm64: [fluentci_v0.15.0_aarch64-unknown-linux-gnu.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.15.0/fluentci_v0.15.0_aarch64-unknown-linux-gnu.tar.gz)
- `Mac`: arm64: [fluentci_v0.15.2_aarch64-apple-darwin.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.15.2/fluentci_v0.15.2_aarch64-apple-darwin.tar.gz) intel: [fluentci_v0.15.2_x86_64-apple-darwin.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.15.2/fluentci_v0.15.2_x86_64-apple-darwin.tar.gz)
- `Linux`: intel: [fluentci_v0.15.2_x86_64-unknown-linux-gnu.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.15.2/fluentci_v0.15.2_x86_64-unknown-linux-gnu.tar.gz) arm64: [fluentci_v0.15.2_aarch64-unknown-linux-gnu.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.15.2/fluentci_v0.15.2_aarch64-unknown-linux-gnu.tar.gz)

## ✨ Quick Start

Expand All @@ -110,7 +110,7 @@ fluentci studio
fluentci --help

Usage: fluentci [pipeline] [jobs...]
Version: 0.15.1
Version: 0.15.2

Description:

Expand Down
83 changes: 83 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/consts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dir } from "../deps.ts";
export const VERSION = "0.15.1";
export const VERSION = "0.15.2";

export const BASE_URL = "https://api.fluentci.io/v1";

Expand Down
1 change: 1 addition & 0 deletions src/server/graphql/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type KV = {
count: () => Promise<number>;
updateStats: (id: string) => Promise<void>;
byName: (name: string) => Promise<Project | null>;
remove: (id: string) => Promise<void>;
};
runs: {
save: (project: string, data: Run) => Promise<void>;
Expand Down
9 changes: 9 additions & 0 deletions src/server/graphql/objects/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export class Project {
reliability?: number;
buildsPerWeek?: number;
recentRuns?: Run[];
isPrivate?: boolean;
owner?: string;
archived?: boolean;

constructor({
id,
Expand All @@ -34,6 +37,9 @@ export class Project {
reliability,
buildsPerWeek,
recentRuns,
isPrivate,
owner,
archived,
}: Project) {
this.id = id;
this.path = path;
Expand All @@ -50,5 +56,8 @@ export class Project {
this.reliability = reliability;
this.buildsPerWeek = buildsPerWeek;
this.recentRuns = recentRuns;
this.isPrivate = isPrivate;
this.owner = owner;
this.archived = archived;
}
}
54 changes: 54 additions & 0 deletions src/server/graphql/resolvers/project/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,57 @@ export async function updateProject(

return ctx.kv.projects.get(args.id);
}

export async function deleteProject(
root: any,
args: any,
ctx: Context
): Promise<boolean> {
const project = await ctx.kv.projects.get(args.id);

if (!project) {
return false;
}

await ctx.kv.projects.remove(args.id);

return true;
}

export async function archiveProject(
root: any,
args: any,
ctx: Context
): Promise<Project | null> {
const project = await ctx.kv.projects.get(args.id);

if (!project) {
return null;
}

await ctx.kv.projects.save({
...project,
archived: true,
});

return ctx.kv.projects.get(args.id);
}

export async function unarchiveProject(
root: any,
args: any,
ctx: Context
): Promise<Project | null> {
const project = await ctx.kv.projects.get(args.id);

if (!project) {
return null;
}

await ctx.kv.projects.save({
...project,
archived: false,
});

return ctx.kv.projects.get(args.id);
}
Loading

0 comments on commit f632510

Please sign in to comment.