mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 10:28:22 +00:00
Implement list order
This commit is contained in:
@@ -60,9 +60,19 @@ export const pkiAcmeOrderDALFactory = (db: TDbClient) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const listByAccountId = async (accountId: string, tx?: Knex) => {
|
||||||
|
try {
|
||||||
|
const orders = await (tx || db)(TableName.PkiAcmeOrder).where({ accountId }).orderBy("createdAt", "desc");
|
||||||
|
return orders;
|
||||||
|
} catch (error) {
|
||||||
|
throw new DatabaseError({ error, name: "List PKI ACME orders by account id" });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...pkiAcmeOrderOrm,
|
...pkiAcmeOrderOrm,
|
||||||
findByIdForFinalization,
|
findByIdForFinalization,
|
||||||
findByAccountAndOrderIdWithAuthorizations
|
findByAccountAndOrderIdWithAuthorizations,
|
||||||
|
listByAccountId
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -84,7 +84,12 @@ type TPkiAcmeServiceFactoryDep = {
|
|||||||
>;
|
>;
|
||||||
acmeOrderDAL: Pick<
|
acmeOrderDAL: Pick<
|
||||||
TPkiAcmeOrderDALFactory,
|
TPkiAcmeOrderDALFactory,
|
||||||
"create" | "transaction" | "updateById" | "findByAccountAndOrderIdWithAuthorizations" | "findByIdForFinalization"
|
| "create"
|
||||||
|
| "transaction"
|
||||||
|
| "updateById"
|
||||||
|
| "findByAccountAndOrderIdWithAuthorizations"
|
||||||
|
| "findByIdForFinalization"
|
||||||
|
| "listByAccountId"
|
||||||
>;
|
>;
|
||||||
acmeAuthDAL: Pick<TPkiAcmeAuthDALFactory, "create" | "findByAccountIdAndAuthIdWithChallenges">;
|
acmeAuthDAL: Pick<TPkiAcmeAuthDALFactory, "create" | "findByAccountIdAndAuthIdWithChallenges">;
|
||||||
acmeOrderAuthDAL: Pick<TPkiAcmeOrderAuthDALFactory, "insertMany">;
|
acmeOrderAuthDAL: Pick<TPkiAcmeOrderAuthDALFactory, "insertMany">;
|
||||||
@@ -727,15 +732,11 @@ export const pkiAcmeServiceFactory = ({
|
|||||||
profileId: string;
|
profileId: string;
|
||||||
accountId: string;
|
accountId: string;
|
||||||
}): Promise<TAcmeResponse<TListAcmeOrdersResponse>> => {
|
}): Promise<TAcmeResponse<TListAcmeOrdersResponse>> => {
|
||||||
const profile = await validateAcmeProfile(profileId);
|
const orders = await acmeOrderDAL.listByAccountId(accountId);
|
||||||
// FIXME: Implement ACME list orders
|
|
||||||
return {
|
return {
|
||||||
status: 200,
|
status: 200,
|
||||||
body: {
|
body: { orders: orders.map((order) => buildUrl(profileId, `/orders/${order.id}`)) },
|
||||||
orders: []
|
|
||||||
},
|
|
||||||
headers: {
|
headers: {
|
||||||
Location: buildUrl(profileId, `/accounts/${accountId}/orders`),
|
|
||||||
Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`
|
Link: `<${buildUrl(profileId, "/directory")}>;rel="index"`
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user