Model ledgers
Permissions
| User Group | Create? | Read? | Update? | Delete? | 
|---|
| super_user | x | x | x | x | 
| line_manager | x | x | x |  | 
| api | x | x | x |  | 
| pos | x | x |  |  | 
| owner |  | x | x | x | 
| admin |  | x |  |  | 
| user | x | x |  |  | 
Fields
| Name | Type | Link | Maps To | Default | Indexed? | Unique? | 
|---|
| __v | Number |  |  |  |  |  | 
| _deleted | Boolean |  |  | false | x |  | 
| _id | ObjectID |  |  | function defaultId() {
  return new oid();
} |  |  | 
| _owner_id | ObjectID | User | _owner |  | x |  | 
| _updated_by_id | ObjectID | User | _updated_by |  | x |  | 
| amount | Number |  |  |  |  |  | 
| balance | Number |  |  |  |  |  | 
| createdAt | Date |  |  |  |  |  | 
| cred_type | String |  |  |  | x |  | 
| currency_id | ObjectID | Currency |  |  | x |  | 
| date | Date |  |  | function now() { [native code] } | x |  | 
| description | String |  |  |  |  |  | 
| details | Mixed |  |  |  |  |  | 
| email | String |  |  |  |  |  | 
| invoice_id | ObjectID | Invoice |  |  | x |  | 
| is_transfer | Boolean |  |  | false |  |  | 
| location_id | ObjectID | Location |  |  | x |  | 
| organisation_id | ObjectID | Organisation |  |  | x |  | 
| partner_id | ObjectID | Partner |  |  | x |  | 
| partner_reference | Mixed |  |  |  |  | x | 
| product_id | Array |  |  | function() {
      // Leave it up to `cast()` to convert the array
      return fn
        ? defaultArr.call(this)
        : defaultArr != null
          ? [].concat(defaultArr)
          : [];
    } |  |  | 
| receipt | String |  |  |  |  |  | 
| reserve | Boolean |  |  | false |  |  | 
| reserve_expires | Date |  |  | function now() { [native code] } |  |  | 
| source_id | ObjectID |  |  |  |  |  | 
| source_type | String |  |  |  |  |  | 
| transaction_type | String |  |  |  |  |  | 
| updatedAt | Date |  |  |  |  |  | 
| user_id | ObjectID | User |  |  | x |  | 
| wallet_id | Array |  |  | function() {
      // Leave it up to `cast()` to convert the array
      return fn
        ? defaultArr.call(this)
        : defaultArr != null
          ? [].concat(defaultArr)
          : [];
    } |  |  | 
| wallet_split | Array |  |  | function() {
      // Leave it up to `cast()` to convert the array
      return fn
        ? defaultArr.call(this)
        : defaultArr != null
          ? [].concat(defaultArr)
          : [];
    } |  |  | 
Raw definition
{
	"path": "__v",
	"instance": "Number",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"__v"
	],
	"options": {},
	"_index": null
}{
	"path": "_deleted",
	"instance": "Boolean",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"_deleted"
	],
	"options": {
		"default": false,
		"index": true
	},
	"_index": true,
	"defaultValue": false
}{
	"path": "_id",
	"instance": "ObjectID",
	"validators": [],
	"getters": [],
	"setters": [
		null
	],
	"_presplitPath": [
		"_id"
	],
	"options": {
		"auto": true,
		"type": "ObjectId"
	},
	"_index": null
}{
	"path": "_owner_id",
	"instance": "ObjectID",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"_owner_id"
	],
	"options": {
		"link": "User",
		"map_to": "_owner",
		"index": true
	},
	"_index": true
}{
	"path": "_updated_by_id",
	"instance": "ObjectID",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"_updated_by_id"
	],
	"options": {
		"link": "User",
		"map_to": "_updated_by",
		"index": true
	},
	"_index": true
}{
	"path": "amount",
	"instance": "Number",
	"validators": [
		{
			"message": "Path `{PATH}` is required.",
			"type": "required"
		}
	],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"amount"
	],
	"options": {
		"required": true
	},
	"_index": null,
	"isRequired": true,
	"originalRequiredValue": true
}{
	"path": "balance",
	"instance": "Number",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"balance"
	],
	"options": {},
	"_index": null
}{
	"path": "createdAt",
	"instance": "Date",
	"validators": [],
	"getters": [],
	"setters": [
		null,
		null
	],
	"_presplitPath": [
		"createdAt"
	],
	"options": {
		"immutable": true
	},
	"_index": null,
	"$immutable": true
}{
	"enumValues": [],
	"regExp": null,
	"path": "cred_type",
	"instance": "String",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"cred_type"
	],
	"options": {
		"index": true
	},
	"_index": true
}{
	"path": "currency_id",
	"instance": "ObjectID",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"currency_id"
	],
	"options": {
		"index": true,
		"link": "Currency"
	},
	"_index": true
}{
	"path": "date",
	"instance": "Date",
	"validators": [
		{
			"message": "Path `{PATH}` is required.",
			"type": "required"
		}
	],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"date"
	],
	"options": {
		"required": true,
		"index": true
	},
	"_index": true,
	"isRequired": true,
	"originalRequiredValue": true
}{
	"enumValues": [],
	"regExp": null,
	"path": "description",
	"instance": "String",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"description"
	],
	"options": {},
	"_index": null
}{
	"path": "details",
	"instance": "Mixed",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"details"
	],
	"options": {},
	"_index": null
}{
	"enumValues": [],
	"regExp": null,
	"path": "email",
	"instance": "String",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"email"
	],
	"options": {},
	"_index": null
}{
	"path": "invoice_id",
	"instance": "ObjectID",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"invoice_id"
	],
	"options": {
		"index": true,
		"link": "Invoice"
	},
	"_index": true
}{
	"path": "is_transfer",
	"instance": "Boolean",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"is_transfer"
	],
	"options": {
		"default": false
	},
	"_index": null,
	"defaultValue": false
}{
	"path": "location_id",
	"instance": "ObjectID",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"location_id"
	],
	"options": {
		"link": "Location",
		"index": true
	},
	"_index": true
}{
	"path": "organisation_id",
	"instance": "ObjectID",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"organisation_id"
	],
	"options": {
		"index": true,
		"link": "Organisation"
	},
	"_index": true
}{
	"path": "partner_id",
	"instance": "ObjectID",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"partner_id"
	],
	"options": {
		"index": true,
		"link": "Partner"
	},
	"_index": true
}{
	"path": "partner_reference",
	"instance": "Mixed",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"partner_reference"
	],
	"options": {
		"unique": true,
		"sparse": true
	},
	"_index": {
		"unique": true,
		"sparse": true,
		"background": true
	}
}{
	"schemaOptions": {
		"timestamps": true,
		"toJSON": {
			"virtuals": true
		},
		"toObject": {
			"virtuals": true
		},
		"perms": {
			"super_user": "crud",
			"line_manager": "cru",
			"api": "cru",
			"pos": "cr",
			"owner": "rud",
			"admin": "r",
			"user": "cr"
		},
		"typeKey": "type",
		"id": true,
		"_id": true,
		"validateBeforeSave": true,
		"read": null,
		"shardKey": null,
		"discriminatorKey": "__t",
		"autoIndex": null,
		"minimize": true,
		"optimisticConcurrency": false,
		"versionKey": "__v",
		"capped": false,
		"bufferCommands": true,
		"strictQuery": true,
		"strict": true,
		"_perms": {
			"admin": "r",
			"owner": "rud",
			"user": "cr",
			"all": "",
			"super_user": "crud",
			"line_manager": "cru",
			"api": "cru",
			"pos": "cr"
		},
		"pluralization": true
	},
	"caster": {
		"path": "product_id",
		"instance": "ObjectID",
		"validators": [],
		"getters": [],
		"setters": [],
		"_presplitPath": [
			"product_id"
		],
		"options": {
			"index": true,
			"link": "Product"
		},
		"_index": true,
		"_arrayPath": "product_id.$",
		"_arrayParentPath": "product_id"
	},
	"$embeddedSchemaType": {
		"path": "product_id",
		"instance": "ObjectID",
		"validators": [],
		"getters": [],
		"setters": [],
		"_presplitPath": [
			"product_id"
		],
		"options": {
			"index": true,
			"link": "Product"
		},
		"_index": true,
		"_arrayPath": "product_id.$",
		"_arrayParentPath": "product_id"
	},
	"$isMongooseArray": true,
	"path": "product_id",
	"instance": "Array",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"product_id"
	],
	"options": {
		"type": [
			{
				"index": true,
				"link": "Product"
			}
		]
	},
	"_index": null
}{
	"enumValues": [],
	"regExp": null,
	"path": "receipt",
	"instance": "String",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"receipt"
	],
	"options": {},
	"_index": null
}{
	"path": "reserve",
	"instance": "Boolean",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"reserve"
	],
	"options": {
		"default": false
	},
	"_index": null,
	"defaultValue": false
}{
	"path": "reserve_expires",
	"instance": "Date",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"reserve_expires"
	],
	"options": {},
	"_index": null
}{
	"path": "source_id",
	"instance": "ObjectID",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"source_id"
	],
	"options": {},
	"_index": null
}{
	"enumValues": [],
	"regExp": null,
	"path": "source_type",
	"instance": "String",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"source_type"
	],
	"options": {},
	"_index": null
}{
	"enumValues": [],
	"regExp": null,
	"path": "transaction_type",
	"instance": "String",
	"validators": [
		{
			"message": "Validator failed for path `{PATH}` with value `{VALUE}`",
			"type": "user defined",
			"validator": {}
		}
	],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"transaction_type"
	],
	"options": {
		"validate": {}
	},
	"_index": null
}{
	"path": "updatedAt",
	"instance": "Date",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"updatedAt"
	],
	"options": {},
	"_index": null
}{
	"path": "user_id",
	"instance": "ObjectID",
	"validators": [
		{
			"message": "Path `{PATH}` is required.",
			"type": "required"
		}
	],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"user_id"
	],
	"options": {
		"index": true,
		"link": "User",
		"required": true
	},
	"_index": true,
	"isRequired": true,
	"originalRequiredValue": true
}{
	"schemaOptions": {
		"timestamps": true,
		"toJSON": {
			"virtuals": true
		},
		"toObject": {
			"virtuals": true
		},
		"perms": {
			"super_user": "crud",
			"line_manager": "cru",
			"api": "cru",
			"pos": "cr",
			"owner": "rud",
			"admin": "r",
			"user": "cr"
		},
		"typeKey": "type",
		"id": true,
		"_id": true,
		"validateBeforeSave": true,
		"read": null,
		"shardKey": null,
		"discriminatorKey": "__t",
		"autoIndex": null,
		"minimize": true,
		"optimisticConcurrency": false,
		"versionKey": "__v",
		"capped": false,
		"bufferCommands": true,
		"strictQuery": true,
		"strict": true,
		"_perms": {
			"admin": "r",
			"owner": "rud",
			"user": "cr",
			"all": "",
			"super_user": "crud",
			"line_manager": "cru",
			"api": "cru",
			"pos": "cr"
		},
		"pluralization": true
	},
	"caster": {
		"path": "wallet_id",
		"instance": "ObjectID",
		"validators": [],
		"getters": [],
		"setters": [],
		"_presplitPath": [
			"wallet_id"
		],
		"options": {
			"index": true,
			"link": "Wallet"
		},
		"_index": true,
		"_arrayPath": "wallet_id.$",
		"_arrayParentPath": "wallet_id"
	},
	"$embeddedSchemaType": {
		"path": "wallet_id",
		"instance": "ObjectID",
		"validators": [],
		"getters": [],
		"setters": [],
		"_presplitPath": [
			"wallet_id"
		],
		"options": {
			"index": true,
			"link": "Wallet"
		},
		"_index": true,
		"_arrayPath": "wallet_id.$",
		"_arrayParentPath": "wallet_id"
	},
	"$isMongooseArray": true,
	"path": "wallet_id",
	"instance": "Array",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"wallet_id"
	],
	"options": {
		"type": [
			{
				"index": true,
				"link": "Wallet"
			}
		]
	},
	"_index": null
}{
	"schemaOptions": {
		"timestamps": true,
		"toJSON": {
			"virtuals": true
		},
		"toObject": {
			"virtuals": true
		},
		"perms": {
			"super_user": "crud",
			"line_manager": "cru",
			"api": "cru",
			"pos": "cr",
			"owner": "rud",
			"admin": "r",
			"user": "cr"
		},
		"typeKey": "type",
		"id": true,
		"_id": true,
		"validateBeforeSave": true,
		"read": null,
		"shardKey": null,
		"discriminatorKey": "__t",
		"autoIndex": null,
		"minimize": true,
		"optimisticConcurrency": false,
		"versionKey": "__v",
		"capped": false,
		"bufferCommands": true,
		"strictQuery": true,
		"strict": true,
		"_perms": {
			"admin": "r",
			"owner": "rud",
			"user": "cr",
			"all": "",
			"super_user": "crud",
			"line_manager": "cru",
			"api": "cru",
			"pos": "cr"
		},
		"pluralization": true
	},
	"caster": {
		"path": "wallet_split",
		"instance": "Mixed",
		"validators": [],
		"getters": [],
		"setters": [],
		"_presplitPath": [
			"wallet_split"
		],
		"options": {},
		"_index": null,
		"_arrayPath": "wallet_split.$",
		"_arrayParentPath": "wallet_split"
	},
	"$embeddedSchemaType": {
		"path": "wallet_split",
		"instance": "Mixed",
		"validators": [],
		"getters": [],
		"setters": [],
		"_presplitPath": [
			"wallet_split"
		],
		"options": {},
		"_index": null,
		"_arrayPath": "wallet_split.$",
		"_arrayParentPath": "wallet_split"
	},
	"$isMongooseArray": true,
	"path": "wallet_split",
	"instance": "Array",
	"validators": [],
	"getters": [],
	"setters": [],
	"_presplitPath": [
		"wallet_split"
	],
	"options": {
		"type": [
			null
		]
	},
	"_index": null
}