-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from mrbandler/develop
Merge develop into master and release version v2.6.2
- Loading branch information
Showing
14 changed files
with
325 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
push: | ||
tags: | ||
- "v*" | ||
- "!v*-beta*" | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "cds2types", | ||
"version": "2.6.1", | ||
"version": "2.6.2", | ||
"description": "CLI to convert CDS models to Typescript interfaces and enumerations", | ||
"main": "./bin/cli.js", | ||
"repository": "[email protected]:mrbandler/cds2types.git", | ||
|
@@ -18,7 +18,8 @@ | |
], | ||
"scripts": { | ||
"start": "node", | ||
"build": "tsc", | ||
"build": "tsc --project tsconfig.build.json", | ||
"test": "tsc --project tsconfig.test.json", | ||
"build:start": "yarn build && yarn start", | ||
"build:link": "yarn build && npm link" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,77 @@ | ||
using { Currency, managed, sap } from '@sap/cds/common'; | ||
using { | ||
Currency, | ||
managed, | ||
sap, | ||
cuid | ||
} from '@sap/cds/common'; | ||
|
||
namespace sap.capire.bookshop; | ||
|
||
entity ArrayUsingEntity : cuid { | ||
inlineArray : array of { | ||
id : String; | ||
quantity : Integer | ||
}; | ||
adressArray : array of Address; | ||
compositoinField : Composition of many { | ||
idComposition : String; | ||
quantityComposition : Integer; | ||
} | ||
} | ||
|
||
entity Books : managed { | ||
key ID : Integer; | ||
title : localized String(111); | ||
descr : localized String(1111); | ||
author : Association to Authors; | ||
genre : Association to Genres; | ||
stock : Integer; | ||
price : Decimal(9,2); | ||
currency : Currency; | ||
key ID : Integer; | ||
title : localized String(111); | ||
descr : localized String(1111); | ||
author : Association to Authors; | ||
genre : Association to Genres; | ||
stock : Integer; | ||
price : Decimal(9, 2); | ||
currency : Currency; | ||
} | ||
|
||
|
||
type Gender : Integer enum { | ||
NonBinary; | ||
Male; | ||
Female; | ||
NonBinary = 1; | ||
Male = 2; | ||
Female = 3; | ||
} | ||
|
||
type NameStr : String(111); | ||
|
||
type Name { | ||
firstname: NameStr; | ||
lastname: NameStr; | ||
firstname : NameStr; | ||
lastname : NameStr; | ||
} | ||
|
||
type Address { | ||
street: String; | ||
houseNo: String; | ||
town: String; | ||
country: String; | ||
street : String; | ||
houseNo : String; | ||
town : String; | ||
country : String; | ||
} | ||
|
||
type Addresses : many Address; | ||
|
||
entity Authors : managed { | ||
key ID : Integer; | ||
name : Name; | ||
gender : Gender; | ||
addresses : Addresses; | ||
dateOfBirth : Date; | ||
dateOfDeath : Date; | ||
placeOfBirth : String; | ||
placeOfDeath : String; | ||
books : Association to many Books on books.author = $self; | ||
key ID : Integer; | ||
name : Name; | ||
gender : Gender; | ||
addresses : Addresses; | ||
dateOfBirth : Date; | ||
dateOfDeath : Date; | ||
placeOfBirth : String; | ||
placeOfDeath : String; | ||
books : Association to many Books | ||
on books.author = $self; | ||
} | ||
|
||
/** Hierarchically organized Code List for Genres */ | ||
/** | ||
* Hierarchically organized Code List for Genres | ||
*/ | ||
entity Genres : sap.common.CodeList { | ||
key ID : Integer; | ||
parent : Association to Genres; | ||
children : Composition of many Genres on children.parent = $self; | ||
key ID : Integer; | ||
parent : Association to Genres; | ||
children : Composition of many Genres | ||
on children.parent = $self; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,48 @@ | ||
using { sap.capire.bookshop as my } from './schema'; | ||
service CatalogService @(path:'/browse') { | ||
using {sap.capire.bookshop as my} from './schema'; | ||
|
||
@readonly entity Books as SELECT from my.Books {*, | ||
author.name as author | ||
} excluding { createdBy, modifiedBy } | ||
service CatalogService @(path : '/browse') { | ||
|
||
actions { | ||
action addRating (stars: Integer); | ||
function getViewsCount() returns Integer; | ||
entity ServiceEntity { | ||
key id : UUID; | ||
arrayComplex : array of arrayParameterType; | ||
arraySimple : array of String; | ||
} | ||
|
||
function getBooks(author : my.Authors.ID) returns array of my.Books; | ||
entity ArrayUsingEntity as projection on my.ArrayUsingEntity; | ||
|
||
@requires_: 'authenticated-user' | ||
action submitOrder (book : Books.ID, amount: Integer); | ||
@readonly | ||
entity Books as | ||
select from my.Books { | ||
*, | ||
author.name as author | ||
} | ||
excluding { | ||
createdBy, | ||
modifiedBy | ||
} | ||
|
||
actions { | ||
action addRating(stars : Integer); | ||
function getViewsCount() returns Integer; | ||
} | ||
|
||
function getBooks(author : my.Authors:ID) returns array of my.Books; | ||
action unboudAction(simpleParameter : String, arrayParameter : array of arrayParameterType, typedParameter : typedParameterType) returns ActionReturnType; | ||
|
||
@requires_ : 'authenticated-user' | ||
action submitOrder(book : Books:ID, amount : Integer); | ||
|
||
|
||
type arrayParameterType : { | ||
value : String; | ||
} | ||
|
||
type typedParameterType : { | ||
value : String; | ||
} | ||
|
||
type ActionReturnType : { | ||
success : Boolean; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// This file should be compilable if the types were created correctly. | ||
|
||
import { sap } from "../service"; | ||
|
||
const address: sap.capire.bookshop.IAddress = { | ||
street: "", | ||
houseNo: "", | ||
town: "", | ||
country: "", | ||
}; | ||
|
||
const author: sap.capire.bookshop.IAuthors = { | ||
ID: 1, | ||
name: { | ||
firstname: "", | ||
lastname: "", | ||
}, | ||
gender: sap.capire.bookshop.Gender.Female, | ||
addresses: [[address]], | ||
dateOfBirth: new Date(), | ||
dateOfDeath: new Date(), | ||
placeOfBirth: "", | ||
placeOfDeath: "", | ||
books: [], | ||
}; | ||
|
||
const book: sap.capire.bookshop.IBooks = { | ||
ID: 1, | ||
title: "", | ||
descr: "", | ||
author: author, | ||
author_ID: 1, | ||
genre: { | ||
ID: 1, | ||
parent: { | ||
ID: 2, | ||
children: [], | ||
name: "", | ||
descr: "", | ||
}, | ||
name: "", | ||
descr: "", | ||
children: [], | ||
}, | ||
genre_ID: 1, | ||
stock: 1, | ||
price: 1, | ||
currency: { | ||
code: "", | ||
descr: "", | ||
name: "", | ||
symbol: "", | ||
}, | ||
currency_code: "", | ||
}; | ||
|
||
const arrayUsingEntity: sap.capire.bookshop.IArrayUsingEntity = { | ||
ID: "", | ||
inlineArray: [], | ||
adressArray: [address], | ||
compositoinField: [ | ||
{ | ||
idComposition: "", | ||
quantityComposition: 1, | ||
up__ID: "1", | ||
}, | ||
], | ||
}; |
Oops, something went wrong.