Add more missing columns

This commit is contained in:
Fang-Pen Lin
2025-11-07 09:18:40 -08:00
parent 0ed464308f
commit 9196e74437
3 changed files with 12 additions and 2 deletions
@@ -78,6 +78,11 @@ export async function up(knex: Knex): Promise<void> {
t.uuid("accountId").notNullable(); t.uuid("accountId").notNullable();
t.foreign("accountId").references("id").inTable(TableName.PkiAcmeAccount).onDelete("CASCADE"); t.foreign("accountId").references("id").inTable(TableName.PkiAcmeAccount).onDelete("CASCADE");
t.timestamp("notBefore").nullable();
t.timestamp("notAfter").nullable();
t.timestamp("expiresAt").notNullable();
// Order status // Order status
t.string("status").notNullable(); // pending, ready, processing, valid, invalid t.string("status").notNullable(); // pending, ready, processing, valid, invalid
+2 -1
View File
@@ -14,7 +14,8 @@ export const PkiAcmeOrdersSchema = z.object({
createdAt: z.date(), createdAt: z.date(),
updatedAt: z.date(), updatedAt: z.date(),
notBefore: z.date().nullable().optional(), notBefore: z.date().nullable().optional(),
notAfter: z.date().nullable().optional() notAfter: z.date().nullable().optional(),
expiresAt: z.date().nullable().optional()
}); });
export type TPkiAcmeOrders = z.infer<typeof PkiAcmeOrdersSchema>; export type TPkiAcmeOrders = z.infer<typeof PkiAcmeOrdersSchema>;
@@ -339,7 +339,11 @@ export const pkiAcmeServiceFactory = ({
const createdOrder = await acmeOrderDAL.create( const createdOrder = await acmeOrderDAL.create(
{ {
accountId: account.id, accountId: account.id,
status: AcmeOrderStatus.Pending status: AcmeOrderStatus.Pending,
notBefore: payload.notBefore ? new Date(payload.notBefore) : undefined,
notAfter: payload.notAfter ? new Date(payload.notAfter) : undefined,
// TODO: read config from the profile to get the expiration time instead
expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000)
}, },
tx tx
); );