Skip to content

Commit

Permalink
Merge pull request stakwork#827 from MuhammadUmer44/feature/bounty-re…
Browse files Browse the repository at this point in the history
…view-store

Add Bounty Review Store and Types
  • Loading branch information
humansinstitute authored Dec 30, 2024
2 parents 7e76efa + 6874b6c commit 7b99bc0
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/store/bountyReviewStore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { makeAutoObservable } from 'mobx';
import { ProofOfWork, BountyTiming } from './interface';

export class BountyReviewStore {
proofs: Record<string, ProofOfWork[]> = {};
timings: Record<string, BountyTiming> = {};
loading = false;
error: string | null = null;

constructor() {
makeAutoObservable(this);
}

setProofs(bountyId: string, proofs: ProofOfWork[]) {
this.proofs[bountyId] = proofs;
}

setTiming(bountyId: string, timing: BountyTiming) {
this.timings[bountyId] = timing;
}

setLoading(loading: boolean) {
this.loading = loading;
}

setError(error: string | null) {
this.error = error;
}

getProofs(bountyId: string): ProofOfWork[] {
return this.proofs[bountyId] || [];
}

getTiming(bountyId: string): BountyTiming | undefined {
return this.timings[bountyId];
}
}

export const bountyReviewStore = new BountyReviewStore();
18 changes: 18 additions & 0 deletions src/store/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,3 +528,21 @@ export interface BountyCard {
payment_pending?: boolean;
assignee?: string;
}

export type BountyReviewStatus = 'New' | 'Accepted' | 'Rejected' | 'Change Requested';

export interface ProofOfWork {
id: string;
bountyId: string;
description: string;
status: BountyReviewStatus;
submittedAt: string;
}

export interface BountyTiming {
totalWorkTimeSeconds: number;
totalAttempts: number;
firstAssignedAt: string | null;
lastPoWAt: string | null;
closedAt: string | null;
}

0 comments on commit 7b99bc0

Please sign in to comment.