Hi Arnav,
I'm Dyari. Thanks for reaching out. I will be happy to assist you in this regard.
If the computer does not turn on at all or turns on only for a second as you mentioned and you are unable to get into Windows or even unable to see the manufacturer's logo, most probably the issue is hardware related and it is best to take it to a reliable shop for hardware checks.
However, you can try these steps to troubleshoot the issue:
1-Make sure the power cable is connected properly or unplug and plug it again.
2-Since it is AiO computer, try to connect it to another power socket available in your room.
3-If you have a hardware knowledge, open its cover and take all the system memory sticks out, examine them for any obvious defects, and then reseat them into the sockets. Make sure that they are seated properly in their slots. If you have multiple sticks of system memory installed and you suspect one is faulty, one thing to try is to reproduce the issue with only one stick of memory module at a time. This will help you to isolate the faulty module.
4-Let the computer to cool down and turn it on after one hour.
Please let me know if you need further assistance and keep me updated.