  const client = await clientPromise;

  try {
    if (!userId) {
      throw new Error('Invalid userId');
    }

    let results = await client
     .db(MONGO_DB)
     .collection('devices')
     .find({ registeredToUser: userId })
     .toArray();

    if (!results) {
      return false;
    }

    results = results.map((device: any) => {
      return {...device, _id: device._id.toString() };
    });

    return results;
  } catch (error) {
    console.error(error);
    return null;
  }
};

export const getDevice = async (deviceId: string) => {
  // Return a single document with a given deviceId
  const client = await clientPromise;

  try {
    if (!deviceId) {
      throw new Error('Invalid deviceId');
    }

    const oId = new ObjectId(deviceId);

    const result = await client
     .db(MONGO_DB)
     .collection('devices')
     .findOne({ _id: oId });

    // Convert `new ObjectId('...')` to string '...'
    return {...result, _id: result._id.toString() };
  } catch (error) {
    console.error(error);
    return null;
  }
};

export const getFirstDevice = async () => {
  const client = await clientPromise;

  const result = await client
   .db(MONGO_DB)
   .collection('devices')
   .findOne({}, { sort: { $natural: -1 } });

  // Convert `new ObjectId('...')` to string '...'
  const { _id,...rest } = result;
  return { _id: _id.toString(),...rest };
};

export const getDeviceById = async (deviceId: string) => {
  // Return a single document with a given deviceId
  const client = await clientPromise;

  try {
    if (!deviceId) {
      throw new Error('Invalid deviceId');
    }

    const result = await client
     .db(MONGO_DB)
     .collection('devices')
     .findOne({ deviceId });

    if (!result) {
      return false;
    }

    return {...result, _id: result._id.toString() };
  } catch (error) {
    console.error(error);
    return null;
  }
};

export const getAllDeviceIds = async () => {
  const results = await getAllDevices();
  const paths = results.map((device: any) => {
    return device._id.toString();
  });

  return paths;
};

export const getRandomDeviceId = async () => {
  const ids = await getAllDeviceIds();

  return ids[generateRandom(ids.length)];
};

export const setDeviceName = async (props: SetDeviceNameProps) => {
  const { deviceId, name } = props;

  const client = await clientPromise;
  const result = await client
   .db(MONGO_DB)
   .collection('devices')
   .updateOne(
      { deviceId },
      { $set: { deviceName: name, timeUpdated: currentTime() } }
    );

  return result;
};

export const setDeviceStatusOn = async (deviceId: string) => {
  const client = await clientPromise;
  const result = await client
   .db(MONGO_DB)
   .collection('devices')
   .updateOne(
      { deviceId },
      { $set: { status: 'on', timeUpdated: currentTime() } }
    );

  return result;
};

export const setDeviceStatusOff = async (deviceId: string) => {
  const client = await clientPromise;
  const result = await client
   .db(MONGO_DB)
   .collection('devices')
   .updateOne(
      { deviceId },
      { $set: { status: 'off', timeUpdated: currentTime() } }
    );

  return result;
};

export const deleteDevice = async (deviceId: string) => {
  // Return a single document with a given deviceId
  const client = await clientPromise;

  try {
    if (!deviceId) {
      throw new Error('Invalid deviceId');
    }

    const oId = new ObjectId(deviceId);

    await client.db(MONGO_DB).collection('devices').remove({ _id: oId });

    return true;
  } catch (error) {
    console.error(error);
    return false;
  }
};

export const deleteAllDevices = async () => {
  const client = await clientPromise;

  try {
    await client.db(MONGO_DB).collection('devices').deleteMany({});

    return true;
  } catch (error) {
    console.error(error);
    return false;
  }
};
There’s not a chance in hell, especially if I’m in a dire situation that could end in my being homeless, hungry &amp;; stranded, would I just hand over an 800 check to a stranger and walk away with the hopes that they’d do the right thing and contact me to give me my money once it clears. No one in their right mind would do that.. ever. Especially when his ability to survive essentially depends on that check. This is probably a scam he pulls often hoping that someone will buy his sob story &amp;; be honest &amp;; actually either, A: give him the money right then after depositing; or B: will actually call him in the money to give him the money. I wouldn’t give someone a 5 dollar check, let alone 800 bucks that I need to survive.There is something in the air… there must be.
We have been forecasting the revival of nu-metal and heavy music into popular culture for quite a bit now. At first, there was only an occasional niche artist that showed any promise. The scene has been developing and building and I think this year is where it really begins.
Gold Frankincense & Myrrh (GFM) is one those bands.
GFM is a crucial piece in this vibrant scene – a potential centerpiece of the burgeoning popularity of femme musicians in the culture. Their latest songs – “Give Me A Sign” & “On the Inside” – showcase a group of creatives with drive and vision that is all too uncommon in the underground music scene. They draw from musical metal influences from the 2000’s including groups like Pierce the Veil, Paramore & Flyleaf.
GFM is a group with a vision. A concise and directed marketing that has proven to be a draw for an ever-growing audience. Their music is tight, clean… and very much metal. I think an all-girl group like GFM is integral for this growing scene – the future looks bright.
For more from Gold Frankincense & Myrrh check out their Instagram, Twitter & Spotify.
First it was ‘I’m So Tired…’. Now it’s ‘Fuck, I’m Lonely’. Lauv is the San Fran born producer-cum-popstar turning his conflicting emotions into chart-smashing bops.
Is this what progress looks like?
'Lucky Strike' features a Californian-inspired love story and a surprising amount of blood.
The pop star took to Twitter after his song from 'Boy Erased' was nominated.
Fill your queer heart with the sound of music.
The ‘Dance to This’ video really does make you want to dance to it.
The film stars Lucas Hedges alongside Nicole Kidman, Russell Crowe, and Troye Sivan.Justin Cuero

Justin Raúl Cuero Palacio (born 18 March, 2004) is an Ecuadorean football player who plays as a forward for Independiente del Valle. He played as Ecuador finished runners-up at the 2022 South American Games and represented his country at the 2023 South American U-20 Championship.
Early life.
Cuero is from Esmeraldas, Ecuador, in the north-western part of the country. He came from the Independiente del Valle football academy.
International career.
Cuero was selected to play Football at the 2022 South American Games in October 2022 for Ecuador in Asunción. He scored a hat-trick in the semi-final against Uruguay to help his team to the final against hosts Paraguay.
Cuero excelled playing for Ecuador at the 2023 South American U-20 Championship. Cuero was Ecuador's top scorer in the initial phase of the tournament from which they qualified for the Hexagonal group stage. Cuero scored four goals in total at the tournament, including two against Paraguay that ensured his country finished in the top four and qualified from the Hexagonal group stage for the 2023 FIFA U-20 World Cup to be held in Indonesia. Cuero thanked the Ecu