// GetAsset returns the given AssetInfo object specified by an unique id.
GetAsset returns the given AssetInfo object specified by an unique id.
// GetAsset returns the given AssetInfo object specified by an unique id .
func (db *DB) GetAsset(assetID string) (*AssetInfo, error) {
	assetInfoCollection := db.Client.Database(constants.AssetUploaderDatabaseName).Collection(constants.AssetUploaderCollectionName)
	asset := &AssetInfo{}
	err := assetInfoCollection.FindOne(
		context.Background(),
		bson.M{
			"awsName": assetID,
		}).Decode(asset)
	if err == mongo.ErrNoDocuments {
		return nil, &ErrorNoAssetFound{ID: assetID}
	}
	if err != nil {
		log.Error().Msgf("Could not fetch asset with id: %s. err: %s", assetID, err)
		return nil, err
	}
	return asset, nil
}
func ( db * DB ) GetAsset ( assetID string ) ( * AssetInfo , error ) { assetInfoCollection := db . Client . Database ( constants . AssetUploaderDatabaseName ) . Collection ( constants . AssetUploaderCollectionName ) asset := & AssetInfo { } err := assetInfoCollection . FindOne ( context . Background ( ) , bson . M { " " : assetID , } ) . Decode ( asset ) if err == mongo . ErrNoDocuments { return nil , & ErrorNoAssetFound { ID : assetID } } if err != nil { log . Error ( ) . Msgf ( " " , assetID , err ) return nil , err } return asset , nil }
GetAsset returns the given AssetInfo object specified by an unique id.
GetAsset returns the given AssetInfo object specified by an unique id .