Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zezs committed Dec 4, 2024
0 parents commit 41f3d47
Show file tree
Hide file tree
Showing 22 changed files with 1,752 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# syntax=docker/dockerfile:1

ARG VARIANT="20"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
ARG CAPVER="latest"

# Install some generally useful tools
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
curl git sqlite3 entr source-highlight

# Install SAP CAP SDK globally
USER node
RUN npm install -g @sap/cds-dk@$CAPVER

# vi mode everywhere and nicer prompt KTHXBAI
RUN cat <<EOBASHRC >> /home/node/.bashrc
export EDITOR=vi
set -o vi
bind -x '"\C-l": clear'
EOBASHRC

RUN echo 'export PS1=${PS1/\$ /\\\\n$ }' >> /home/node/.bashrc

# Ready!
WORKDIR /home/node
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "Back to basics - SAP CAP - dev container",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "20"
}
},
"customizations": {
"vscode": {
"extensions": [
"sapse.vscode-cds",
"dbaeumer.vscode-eslint",
"humao.rest-client",
"qwtel.sqlite-viewer",
"mechatroner.rainbow-csv"
]
}
},
"forwardPorts": [
4004
],
"remoteUser": "node"
}
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# CAP capb2b-main
_out
*.db
*.sqlite
connection.properties
default-*.json
.cdsrc-private.json
gen/
node_modules/
target/

# Web IDE, App Studio
.che/
.gen/

# MTA
*_mta_build_tmp
*.mtar
mta_archives/

# Other
.DS_Store
*.orig
*.log

*.iml
*.flattened-pom.xml

# IDEs
# .vscode
# .idea

# @cap-js/cds-typer
@cds-models
13 changes: 13 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"recommendations": [
"SAPSE.vscode-cds",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"mechatroner.rainbow-csv",
"qwtel.sqlite-viewer",
"humao.rest-client"
],
"unwantedRecommendations": [

]
}
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "cds serve",
"request": "launch",
"type": "node",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "cds",
"args": [
"serve",
"--with-mocks",
"--in-memory?"
],
"skipFiles": [
"<node_internals>/**"
]
}
]
}
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
// uncomment entries once all libraries have been installed via 'npm install'
"eslint.validate": [
// "cds",
// "csn",
// "csv",
// "csv (semicolon)",
// "tab",
// "tsv"
]
}
23 changes: 23 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "cds watch",
"command": "cds",
"args": ["watch"],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"type": "shell",
"label": "cds serve",
"command": "cds",
"args": ["serve", "--with-mocks", "--in-memory?"],
"problemMatcher": []
}
]
}
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Getting Started

Welcome to your new project.

It contains these folders and files, following our recommended project layout:

File or Folder | Purpose
---------|----------
`app/` | content for UI frontends goes here
`db/` | your domain models and data go here
`srv/` | your service models and code go here
`package.json` | project metadata and configuration
`readme.md` | this getting started guide


## Next Steps

- Open a new terminal and run `cds watch`
- (in VS Code simply choose _**Terminal** > Run Task > cds watch_)
- Start adding content, for example, a [db/schema.cds](db/schema.cds).


## Learn More

Learn more at https://cap.cloud.sap/docs/get-started/.
Binary file added aextras/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added aextras/image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions aextras/services5.cds
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// removed the key and decorated each of the entities with aspects
// aspects for entities with canonical user id
using {cuid, managed} from '@sap/cds/common';

service bookshop {
entity Books{
key ID: Integer;
title: String;
}

entity Authors{
key ID: Integer;
name: String;
}

}


// service bookshop {
// entity Books {
// key ID: Integer;
// title: String;
// }

// entity Authors {
// key ID: Integer;
// name: String;
// }

// entity Customer {
// key ID: Integer;
// name: String;
// email: String;
// }

// }

// "cds": {
// "requires": {
// "db": {
// "kind": "sqlite",
// "credentials": {
// "url": "bookshop.sqlite"
// }
// }
// }
// }
20 changes: 20 additions & 0 deletions aextras/uuid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// this will generate new line at the end
// console.log(require("crypto").randomUUID())
// console.log(require("crypto").randomUUID())

// // does not generate a new line
// process.stdout.write(require("crypto").randomUUID())
// process.stdout.write(require("crypto").randomUUID())

// if (require('tty').isatty(process.stdout.fd)){
// // if in terminal
// console.log(require("crypto").randomUUID())
// } else {
// // if not terminal: code editor
// process.stdout.write(require("crypto").randomUUID())
// }

console.log(require("crypto").randomUUID())
console.log(require("crypto").randomUUID())
console.log(require("crypto").randomUUID())
console.log(require("crypto").randomUUID())
Binary file added bookshop.sqlite-shm
Binary file not shown.
Binary file added bookshop.sqlite-wal
Binary file not shown.
5 changes: 5 additions & 0 deletions data/bookshop-Authors.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ID, name
0118aff8e4-8f6f-40cd-b3c5-c62c0c3d8743, Douglas Noel Adams
a93e6d73-5d6a-45da-89f9-780518daadc9, Iain M. Banks


4 changes: 4 additions & 0 deletions data/bookshop-Books.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ID, title, author_ID
d6b44ec8-bcce-4fbe-acdf-de91b3920821, The Hitch Hiker's Galaxy, 0118aff8e4-8f6f-40cd-b3c5-c62c0c3d8743
bec72439-2921-44a1-9209-4823d368eaef, Mostly Harmless, 0118aff8e4-8f6f-40cd-b3c5-c62c0c3d8743
7064717-de0d-4bcd-9113-a5316e1885ae, The player of Games, a93e6d73-5d6a-45da-89f9-780518daadc9
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import cds from '@sap/cds/eslint.config.mjs'
export default [ ...cds.recommended ]
Loading

0 comments on commit 41f3d47

Please sign in to comment.