Which patient should be treated first?

Since the beginning of Covid-19, doctors and healthcare workers have been facing dilemmas everyday. Since a lot of people caught covid, a lot of healthcare institution and hospital had trouble to take care of everyone due to the lack of equipment such as ventilators. One of the most recurrent dilemma seems to be concerning on which people to treat first due to the deficit in personal and equipment. In other words, do doctors must prioritize ventilatory support for a critical patient who is unlikely to survive or use the ventilators for a less critical patient with better prognosis?