mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
Sort node projects by HEAD commit time
Instead of going with project activity which is being stripped everything that is older than one year, we should look at the current project head time. Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
+11
-41
@@ -25,6 +25,7 @@ import {
|
||||
object,
|
||||
string,
|
||||
union,
|
||||
z,
|
||||
} from "zod";
|
||||
|
||||
import {
|
||||
@@ -46,26 +47,6 @@ import {
|
||||
patchCreatedSchema,
|
||||
} from "./project/patch.js";
|
||||
|
||||
export interface Project {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
defaultBranch: string;
|
||||
delegates: string[];
|
||||
head: string;
|
||||
patches: {
|
||||
open: number;
|
||||
draft: number;
|
||||
archived: number;
|
||||
merged: number;
|
||||
};
|
||||
issues: {
|
||||
open: number;
|
||||
closed: number;
|
||||
};
|
||||
trackings: number;
|
||||
}
|
||||
|
||||
const projectSchema = object({
|
||||
id: string(),
|
||||
name: string(),
|
||||
@@ -84,25 +65,16 @@ const projectSchema = object({
|
||||
closed: number(),
|
||||
}),
|
||||
trackings: number(),
|
||||
}) satisfies ZodSchema<Project>;
|
||||
});
|
||||
const projectsSchema = array(projectSchema);
|
||||
|
||||
const projectsSchema = array(projectSchema) satisfies ZodSchema<Project[]>;
|
||||
|
||||
export interface Activity {
|
||||
activity: number[];
|
||||
}
|
||||
export type Project = z.infer<typeof projectSchema>;
|
||||
|
||||
const activitySchema = object({
|
||||
activity: array(number()),
|
||||
}) satisfies ZodSchema<Activity>;
|
||||
});
|
||||
|
||||
export interface Blob {
|
||||
binary: boolean;
|
||||
content?: string;
|
||||
name: string;
|
||||
path: string;
|
||||
lastCommit: CommitHeader;
|
||||
}
|
||||
export type Activity = z.infer<typeof activitySchema>;
|
||||
|
||||
const blobSchema = object({
|
||||
binary: boolean(),
|
||||
@@ -110,19 +82,17 @@ const blobSchema = object({
|
||||
name: string(),
|
||||
path: string(),
|
||||
lastCommit: commitHeaderSchema,
|
||||
}) satisfies ZodSchema<Blob>;
|
||||
});
|
||||
|
||||
interface TreeEntry {
|
||||
path: string;
|
||||
name: string;
|
||||
kind: "tree" | "blob";
|
||||
}
|
||||
export type Blob = z.infer<typeof blobSchema>;
|
||||
|
||||
const treeEntrySchema = object({
|
||||
path: string(),
|
||||
name: string(),
|
||||
kind: union([literal("blob"), literal("tree")]),
|
||||
}) satisfies ZodSchema<TreeEntry>;
|
||||
});
|
||||
|
||||
export type TreeEntry = z.infer<typeof treeEntrySchema>;
|
||||
|
||||
export interface TreeStats {
|
||||
commits: number;
|
||||
|
||||
Reference in New Issue
Block a user