Git Product home page Git Product logo

nearmusic's Introduction

NearMusic - Near Protocol

Unlike classical music listening applications it is an app where you pay for the number of music listening without paying a monthly fee ... https://www.loom.com/share/3f75552a65e84fe1a47209bc2b7d13da

Roles

Admin Usage

  • Create songs with song name, artist name, genre, description etc. fields. Then may modify, inactivate them.
  • EDetermines and creates membership types.

User Usage

  • Creates membership, buy subscription types so buys the right to play songs. Also may checks/list songs, account details.

Models

Song

Name Type
owner AccountId
artist String
songName String
Description String
albumName String
genre String
label String
country String
isActive bool
CreatedDate Timestamp
ModifiedDate Timestamp
DeletedDate Timestamp

SubscriptionType

Name Type
owner AccountId
typeCode String
price Money
listenSongCount i32
CreatedDate Timestamp
ModifiedDate Timestamp
DeletedDate Timestamp

Subscriber

Name Type
owner AccountId
subscriptionType i32
remainingListenSongCount i32
CreatedDate Timestamp
ModifiedDate Timestamp

Build and devDeploy

yarn
yarn build:release
near dev-deploy ./build/release/nearMusic.wasm
export CONTRACT=<AccountId>
echo $CONTRACT

Creating Accounts

near create-account <subAccName1>.<AccountName>.testnet --masterAccount <AccountName>.testnet --initialBalance 10
near create-account <subAccName2>.<AccountName>.testnet --masterAccount <AccountName>.testnet --initialBalance 10

near state <subAccName1>.<AccountName>.testnet
near state <subAccName2>.<AccountName>.testnet
near state <AccountName>.testnet

near send <AccountName>.testnet <subAccName1>.<AccountName>.testnet 10
near delete <subAccName1>.<AccountName>.testnet <AccountName>.testnet
near delete <subAccName2>.<AccountName>.testnet <AccountName>.testnet

Functions Usage

Initializing

near call $CONTRACT init --accountId aysug.testnet

Adding Song

near call $CONTRACT addSong '{"artist":"Beyonce","songName":"Crazy in love","description":"feat JayZ","albumName":"Dangerous in love","genre":"R&B","label":"Sony Music","country":"USA"}' --accountId aysug.testnet

Modifying Song

near call $CONTRACT modifySong '{"songId":0,"artist":"Beyonce","songName":"Crazy in love","description":"feat JayZ MODIFIED","albumName":"Crazy in love","genre":"R&B","label":"Sony Music","country":"USA"}' --accountId aysug.testnet

Inactivating Song

near call $CONTRACT inactivateSong '{"songId":0}' --accountId aysug.testnet

Getting All Songs

near view $CONTRACT getAllSongs

Getting Songs With Parameters

near view $CONTRACT getSongsBySongId '{"songId":0}'
near view $CONTRACT getSongsByArtistName '{"artistName":"Beyonce"}'
near view $CONTRACT getSongsBySongName '{"songName":"Crazy in love"}'
near view $CONTRACT getSongsByAlbumName '{"albumName":"Crazy in love"}'

Creating Subscriber

near call $CONTRACT createSubscriber --accountId sub1.aysug.testnet

Buyying Subscription

near call $CONTRACT buySubscription '{"subscriberId":0,"subscriptionTypeId":0}' --accountId sub1.aysug.testnet --deposit 3

Getting All Subscribers

near view $CONTRACT getAllSubscribers

Getting Subscribers With Parameter

near view $CONTRACT getSubscribersBySubscriberId '{"subscriberId":0}'
near view $CONTRACT getSubscribersByAccountId '{"AccountId":"sub1.aysug.testnet"}'

Adding Subscription Type

near call $CONTRACT addSubscriptionType '{"typeCode":"Basic","price":"500000000000000000000000","listenSongCount":500}' --accountId aysug.testnet

Modifying Subscription Type

near call $CONTRACT modifySubscriptionType '{"subscriptionTypeId":3,"typeCode":"Old Type MODIFIED","price":"100000000000000000000000","listenSongCount":100}' --accountId aysug.testnet

Getting All Subscription Type

near view $CONTRACT getAllSubscriptionTypes '{}'

Getting All Subscription Type By Type Id

near view $CONTRACT getSubscriptionTypesByTypeID '{"subscriptionTypeId":2}'

nearmusic's People

Contributors

aysuays avatar sercangur avatar

Stargazers

Büşra avatar

Watchers

 avatar

Forkers

selahaddin64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.