feat: add app ping url (#2380)
Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
@@ -56,7 +56,11 @@ export const appRouter = createTRPCRouter({
|
||||
}),
|
||||
selectable: protectedProcedure
|
||||
.input(z.void())
|
||||
.output(z.array(selectAppSchema.pick({ id: true, name: true, iconUrl: true, href: true, description: true })))
|
||||
.output(
|
||||
z.array(
|
||||
selectAppSchema.pick({ id: true, name: true, iconUrl: true, href: true, pingUrl: true, description: true }),
|
||||
),
|
||||
)
|
||||
.meta({
|
||||
openapi: {
|
||||
method: "GET",
|
||||
@@ -73,6 +77,7 @@ export const appRouter = createTRPCRouter({
|
||||
iconUrl: true,
|
||||
description: true,
|
||||
href: true,
|
||||
pingUrl: true,
|
||||
},
|
||||
orderBy: asc(apps.name),
|
||||
});
|
||||
@@ -121,6 +126,7 @@ export const appRouter = createTRPCRouter({
|
||||
description: input.description,
|
||||
iconUrl: input.iconUrl,
|
||||
href: input.href,
|
||||
pingUrl: input.pingUrl === "" ? null : input.pingUrl,
|
||||
});
|
||||
|
||||
return { appId: id };
|
||||
@@ -164,6 +170,7 @@ export const appRouter = createTRPCRouter({
|
||||
description: input.description,
|
||||
iconUrl: input.iconUrl,
|
||||
href: input.href,
|
||||
pingUrl: input.pingUrl === "" ? null : input.pingUrl,
|
||||
})
|
||||
.where(eq(apps.id, input.id));
|
||||
}),
|
||||
|
||||
@@ -158,6 +158,7 @@ describe("create should create a new app with all arguments", () => {
|
||||
description: "React components and hooks library",
|
||||
iconUrl: "https://mantine.dev/favicon.svg",
|
||||
href: "https://mantine.dev",
|
||||
pingUrl: "https://mantine.dev/a",
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -170,6 +171,7 @@ describe("create should create a new app with all arguments", () => {
|
||||
expect(dbApp!.description).toBe(input.description);
|
||||
expect(dbApp!.iconUrl).toBe(input.iconUrl);
|
||||
expect(dbApp!.href).toBe(input.href);
|
||||
expect(dbApp!.pingUrl).toBe(input.pingUrl);
|
||||
});
|
||||
|
||||
test("should create a new app only with required arguments", async () => {
|
||||
@@ -185,6 +187,7 @@ describe("create should create a new app with all arguments", () => {
|
||||
description: null,
|
||||
iconUrl: "https://mantine.dev/favicon.svg",
|
||||
href: null,
|
||||
pingUrl: "",
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -197,6 +200,7 @@ describe("create should create a new app with all arguments", () => {
|
||||
expect(dbApp!.description).toBe(input.description);
|
||||
expect(dbApp!.iconUrl).toBe(input.iconUrl);
|
||||
expect(dbApp!.href).toBe(input.href);
|
||||
expect(dbApp!.pingUrl).toBe(null);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -225,6 +229,7 @@ describe("update should update an app", () => {
|
||||
description: "React components and hooks library",
|
||||
iconUrl: "https://mantine.dev/favicon.svg2",
|
||||
href: "https://mantine.dev",
|
||||
pingUrl: "https://mantine.dev/a",
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -257,6 +262,7 @@ describe("update should update an app", () => {
|
||||
iconUrl: "https://mantine.dev/favicon.svg",
|
||||
description: null,
|
||||
href: null,
|
||||
pingUrl: "",
|
||||
});
|
||||
|
||||
// Assert
|
||||
|
||||
Reference in New Issue
Block a user