diff --git a/source/SIL.AppBuilder.Portal/src/routes/(authenticated)/tasks/+page.server.ts b/source/SIL.AppBuilder.Portal/src/routes/(authenticated)/tasks/+page.server.ts index 8c4718a29..4c5bf8fd8 100644 --- a/source/SIL.AppBuilder.Portal/src/routes/(authenticated)/tasks/+page.server.ts +++ b/source/SIL.AppBuilder.Portal/src/routes/(authenticated)/tasks/+page.server.ts @@ -3,6 +3,10 @@ import type { PageServerLoad } from './$types'; export const load: PageServerLoad = async (event) => { const session = await event.locals.auth(); + //----temporary, remove later----- + const products = await prisma.products.findMany({ select: { Id: true }}); + console.log(products); + //-------------------------------- const tasks = await prisma.userTasks.findMany({ where: { UserId: session?.user.userId diff --git a/source/SIL.AppBuilder.Portal/src/routes/(authenticated)/tasks/[product_id]/+page.server.ts b/source/SIL.AppBuilder.Portal/src/routes/(authenticated)/tasks/[product_id]/+page.server.ts index 7454af0e9..4e6b8e925 100644 --- a/source/SIL.AppBuilder.Portal/src/routes/(authenticated)/tasks/[product_id]/+page.server.ts +++ b/source/SIL.AppBuilder.Portal/src/routes/(authenticated)/tasks/[product_id]/+page.server.ts @@ -6,23 +6,14 @@ type Fields = { email?: string; //Product.Project.Owner.Email name: string; //Product.Project.Name description: string; //Product.Project.Description - store?: string; //Product.Store.Name + store?: string; //Product.Store.Description listingLanguage?: string; //Product.StoreLanguage.Name - projectURL?: string; //Product.Project.WorkflowAppProjectURL? - product?: string; //Product.ProductDefinition.Name? - appType?: string; //Product.ProductDefinition.ApplicationTypes.Name - langCode?: string; //Product.Project.Language? + projectURL?: string; //Product.Project.WorkflowAppProjectURL + product?: string; //Product.ProductDefinition.Description + appType?: string; //Product.ProductDefinition.ApplicationTypes.Description + langCode?: string; //Product.Project.Language } -//replace with Product.ProductArtifacts -type File = { - BuildId: number; - Type: string; - Size: string; - URL: string; - Id: number; -}; - //replace with Product.Project.Reviewers type User = { Id: number; @@ -31,21 +22,83 @@ type User = { }; export const load = (async ({ params, url, locals }) => { - const userInfo = (await locals.auth())?.user; - console.log(userInfo); + const product = await prisma.products.findUnique({ + where: { + Id: params.product_id + }, + select: { + Project: { + select: { + Name: true, + Description: true, + WorkflowAppProjectUrl: true, + Language: true, + Owner: { + select: { + Name: true, + Email: true + } + }, + Reviewers: { + select: { + Id: true, + Name: true, + Email: true + } + } + } + }, + Store: { + select: { + Description: true + } + }, + StoreLanguage: { + select: { + Name: true + } + }, + ProductDefinition: { + select: { + Name: true, + ApplicationTypes: { + select: { + Description: true + } + } + } + }, + ProductArtifacts: { + select: { + ProductBuildId: true, + ContentType: true, + FileSize: true, + Url: true, + Id: true + } + } + } + }); - const products = await prisma.products.findMany(); - console.log(products); return { actions: [], taskTitle: "Waiting", instructions: "waiting", - //filter fields based on task + //filter fields/files/reviewers based on task once workflows are implemented + //possibly filter in the original query to increase database efficiency fields: { - name: "Test Project", - description: "a test project" + user: product?.Project.Owner.Name, + email: product?.Project.Owner.Email, + name: product?.Project.Name, + description: product?.Project.Description, + store: product?.Store?.Description, + listingLanguage: product?.StoreLanguage?.Name, + projectURL: product?.Project.WorkflowAppProjectUrl, + product: product?.ProductDefinition.Name, + appType: product?.ProductDefinition.ApplicationTypes.Description, + langCode: product?.Project.Language } as Fields, - files: [] as File[], - reviewers: [] as User[] + files: product?.ProductArtifacts, + reviewers: product?.Project.Reviewers } }) satisfies PageServerLoad; \ No newline at end of file diff --git a/source/SIL.AppBuilder.Portal/src/routes/(authenticated)/tasks/[product_id]/+page.svelte b/source/SIL.AppBuilder.Portal/src/routes/(authenticated)/tasks/[product_id]/+page.svelte index 214dd5669..1f24b6313 100644 --- a/source/SIL.AppBuilder.Portal/src/routes/(authenticated)/tasks/[product_id]/+page.svelte +++ b/source/SIL.AppBuilder.Portal/src/routes/(authenticated)/tasks/[product_id]/+page.svelte @@ -8,7 +8,7 @@