INNER CODE UNIT · TypeScript
nextMessageIdAndCreationDate
pagopa/io-app · apps/dev-api-server/src/features/messages/utils/index.ts:12
export const nextMessageIdAndCreationDate = () => {
const id = `${nextId++}`.padStart(26, "0");
nextDate.setHours(nextDate.getHours() + 1);
return { id, created_at: new Date(nextDate) };
};
export const bodyToString = (
body: unknown
): Either<ExpressFailure, string | undefined> => {
if (body == null) {
return right(undefined);
}
if (typeof body === "object") {
try {
return right(JSON.stringify(body));
} catch (e) {
return left({
httpStatusCode: 400,