Creating entry from controller goes to draft

System Information
  • Strapi Version: 4.3.9
  • Operating System: ubuntu 18
  • Database: sqlite
  • Node Version: 16.17.0
  • NPM Version: 8.15.0
  • Yarn Version: 1.22.19

When I create entry from strapi backend controller it doesnt publish automatically. What should I do so that once I make post request to /api/orders it should publish automatically?

/src/api/order/controllers/order.js

"use strict";

/**
 * Order.js controller
 *
 * @description: A set of functions called "actions" for managing `Order`.
 */

const stripe = require("stripe")(process.env.STRIPE_SECRET_KEY);
const { createCoreController } = require("@strapi/strapi").factories;

module.exports = createCoreController("api::order.order", ({ strapi }) => ({
  async create(ctx) {
    const { products, amount, token } = ctx.request.body;

    await stripe.charges.create({
      // Transform cents to dollars.
      amount: amount * 100,
      currency: "usd",
      description: `Order ${new Date()} by ${ctx.state.user.id}`,
      source: token,
    });
    const order = await strapi.entityService.create("api::order.order", {
      data: {
        user: ctx.state.user,
        amount,
        products,
      },
    });
    return order;
  },
}));

It’s normal behaviour, add this when using entityService

 publishedAt: new Date().getTime(),