// AddNewAsset creates a new AssetInfo entry and stores it in MongoDB.
AddNewAsset creates a new AssetInfo entry and stores it in MongoDB.
// AddNewAsset creates a new AssetInfo entry and stores it in MongoDB .
func (db *DB) AddNewAsset(assetName, url string) (string, error) {
	assetInfo := &AssetInfo{
		Name:         assetName,
		URL:          url,
		UploadStatus: constants.AssetStatusCreated,
	}
	assetInfoCollection := db.Client.Database(constants.AssetUploaderDatabaseName).Collection(constants.AssetUploaderCollectionName)
	_, err := assetInfoCollection.InsertOne(context.Background(), assetInfo)
	if err != nil {
		return "", err
	}
	return assetName, nil
}
func ( db * DB ) AddNewAsset ( assetName , url string ) ( string , error ) { assetInfo := & AssetInfo { Name : assetName , URL : url , UploadStatus : constants . AssetStatusCreated , } assetInfoCollection := db . Client . Database ( constants . AssetUploaderDatabaseName ) . Collection ( constants . AssetUploaderCollectionName ) _ , err := assetInfoCollection . InsertOne ( context . Background ( ) , assetInfo ) if err != nil { return " " , err } return assetName , nil }
AddNewAsset creates a new AssetInfo entry and stores it in MongoDB.
AddNewAsset creates a new AssetInfo entry and stores it in MongoDB .