Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…m-connect into dev
  • Loading branch information
elYanuki committed Sep 20, 2024
2 parents 4f1f376 + 2efd987 commit 2683a8e
Show file tree
Hide file tree
Showing 16 changed files with 145 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public record DeviceTypeGlobalIdDTO(
Long head_id,
Long mount_id,
Long system_id,
Long photo_resolution_id,
String description
)
{
Expand All @@ -31,67 +32,67 @@ public record DeviceTypeGlobalIdDTO(
/**
* For CameraType
*/
public DeviceTypeGlobalIdDTO(Long type_id, String name, String image, boolean autofocus, Long mount_id, Long system_id) {
this(type_id, name, image, autofocus, "", "", 0, 0, 0, 0, false, false, false, 0, false, false, 0, null, null, null, mount_id, "");
public DeviceTypeGlobalIdDTO(Long type_id, String name, String image, boolean autofocus, Long mount_id, Long photo_resolution_id, Long system_id) {
this(type_id, name, image, autofocus, "", "", 0, 0, 0, 0, false, false, false, 0, false, false, 0, null, null, mount_id, system_id, photo_resolution_id, "");
}

/**
* For DroneType
*/
public DeviceTypeGlobalIdDTO(Long type_id, String name, String image, Long sensor_id, int flight_time, int max_range) {
this(type_id, name, image, false, "", "", 0, max_range, 0, 0, false, false, false, 0, false, false, 0, null, sensor_id, null, null, "");
this(type_id, name, image, false, "", "", 0, max_range, 0, 0, false, false, false, 0, false, false, 0, null, sensor_id, null, null, null, "");
}

/**
* For LensType
*/
public DeviceTypeGlobalIdDTO(Long type_id, String name, String image, String f_stop, String focal_length, Long mount_id) {
this(type_id, name, image, false, f_stop, focal_length, 0, 0, 0, 0, false, false, false, 0, false, false, 0, null, mount_id, null, null, "");
this(type_id, name, image, false, f_stop, focal_length, 0, 0, 0, 0, false, false, false, 0, false, false, 0, null, mount_id, null, null, null, "");
}

/**
* For LightType
*/
public DeviceTypeGlobalIdDTO(Long type_id, String name, String image, boolean rgb, boolean variable_temperature, int watts) {
this(type_id, name, image, false, "", "", 0, 0, 0, 0, false, false, false, 0, rgb, variable_temperature, watts, null, null, null, null, "");
this(type_id, name, image, false, "", "", 0, 0, 0, 0, false, false, false, 0, rgb, variable_temperature, watts, null, null, null, null, null, "");
}

/**
* For MicrophoneType
*/
public DeviceTypeGlobalIdDTO(Long type_id, String name, String image, boolean needs_recorder, Long connector_id, boolean needs_power) {
this(type_id, name, image, false, "", "", 0, 0, 0, 0, false, needs_recorder, needs_power, 0, false, false, 0, connector_id, null, null, null, "");
this(type_id, name, image, false, "", "", 0, 0, 0, 0, false, needs_recorder, needs_power, 0, false, false, 0, connector_id, null, null, null, null, "");
}

/**
* For SimpleType
*/
public DeviceTypeGlobalIdDTO(Long type_id, String name, String description, String image) {
this(type_id, name, image, false, "", "", 0, 0, 0, 0, false, false, false, 0, false, false, 0, null, null, null, null, description);
this(type_id, name, image, false, "", "", 0, 0, 0, 0, false, false, false, 0, false, false, 0, null, null, null, null, null, description);
}

/**
* For StabilizerType
*/
public DeviceTypeGlobalIdDTO(Long type_id, String name, String image, double max_weight_kilograms, int number_of_axis) {
this(type_id, name, image, false, "", "", 0, max_weight_kilograms, 0, 0, false, false, false, number_of_axis, false, false, 0, null, null, null, null, "");
this(type_id, name, image, false, "", "", 0, max_weight_kilograms, 0, 0, false, false, false, number_of_axis, false, false, 0, null, null, null, null, null, "");
}

/**
* For TripodType
*/
public DeviceTypeGlobalIdDTO(Long type_id, String name, String image, int height_centimeters, Long head_id) {
this(type_id, name, image, false, "", "", height_centimeters, 0, 0, 0, false, false, false, 0, false, false, 0, null, head_id, null, null, "");
this(type_id, name, image, false, "", "", height_centimeters, 0, 0, 0, false, false, false, 0, false, false, 0, null, head_id, null, null, null, "");
}

/**
* For AudioType
*/
public DeviceTypeGlobalIdDTO(Long type_id, String name, String image, Long connector_id) {
this(type_id, name, image, false, "", "", 0, 0, 0, 0, false, false, false, 0, false, false, 0, connector_id, null, null, null, "");
this(type_id, name, image, false, "", "", 0, 0, 0, 0, false, false, false, 0, false, false, 0, connector_id, null, null, null, null, "");
}

public String toCsvString(){
return type_id + ";" + name + ";" + image + ";" + autofocus + ";" + f_stop + ";" + focal_length + ";" + height_centimeters + ";" + max_weight_kilograms + ";" + max_range + ";" + flight_time + ";" + requires_license + ";" + needs_recorder + ";" + needs_power + ";" + number_of_axis + ";" + rgb + ";" + variable_temperature + ";" + watts + ";" + connector_id + ";" + head_id + ";" + mount_id + ";" + system_id + ";" + description + "\n";
return type_id + ";" + name + ";" + image + ";" + autofocus + ";" + f_stop + ";" + focal_length + ";" + height_centimeters + ";" + max_weight_kilograms + ";" + max_range + ";" + flight_time + ";" + requires_license + ";" + needs_recorder + ";" + needs_power + ";" + number_of_axis + ";" + rgb + ";" + variable_temperature + ";" + watts + ";" + connector_id + ";" + head_id + ";" + mount_id + ";" + system_id + ";" + photo_resolution_id + ";" + description + "\n";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ public record DeviceTypeGlobalObjectsDTO(
TripodHead head,
LensMount mount,
CameraSystem system,
CameraResolution photo_resolution,
String description
) { }
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class CameraType extends DeviceType {
@JoinColumn(name = "system_id")
private CameraSystem system;
@ManyToOne
@JoinColumn(name = "photoresolution_id")
private CameraResolution photoresolution;
@JoinColumn(name = "photo_resolution_id")
private CameraResolution photo_resolution;
private boolean autofocus;

@Override
Expand All @@ -33,6 +33,7 @@ public void update(DeviceTypeGlobalObjectsDTO data) {
setAutofocus(data.autofocus());
setMount(data.mount());
setSystem(data.system());
setPhoto_resolution(data.photo_resolution());
}catch (Exception ex){
throw new CCException(1106);
}
Expand Down Expand Up @@ -82,4 +83,12 @@ public CameraSystem getSystem() {
public void setSystem(CameraSystem system) {
this.system = system;
}

public CameraResolution getPhoto_resolution() {
return photo_resolution;
}

public void setPhoto_resolution(CameraResolution photo_resolution) {
this.photo_resolution = photo_resolution;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public DeviceType update(Long id, DeviceTypeGlobalIdDTO data){
em.find(TripodHead.class, data.head_id()),
em.find(LensMount.class, data.mount_id()),
em.find(CameraSystem.class, data.system_id()),
em.find(CameraResolution.class, data.photo_resolution_id()),
data.description()
);

Expand Down
20 changes: 10 additions & 10 deletions backend/src/main/resources/import.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ VALUES
* everything above this line are inserts that we probably want to keep permanently as default values
* everything below here are inserts that we throw away when going into production since they are purely for testing purposes
*/
-- Cameras

INSERT INTO devicetype (name, image_blob, variant, dtype, mount_id, photo_resolution_id, system_id, autofocus, status)
VALUES
('Canon EOS 5D Mark IV', 'url1', 'camera', 'CameraType', 6, 3, 1, true, 'active'),
('Nikon D850', 'url2', 'camera', 'CameraType', 6, 3, 2, true, 'active'),
('Sony Alpha a7 III', 'url3', 'camera', 'CameraType', 7, 4, 1, true, 'active'),
('Fujifilm X-T3', 'url4', 'camera', 'CameraType', 7, 5, 1, false, 'active'),
('Olympus OM-D E-M10 Mark III', 'url5', 'camera', 'CameraType', 8,4, 2, true, 'active');

-- Audio
INSERT INTO devicetype (name, image_blob, variant, dtype, connector_id, status)
VALUES
Expand Down Expand Up @@ -106,16 +116,6 @@ VALUES
('DJI Phantom 4', 'url4', 'drone', 'DroneType', 5, 28, true, 'active'),
('Yuneec Typhoon H Pro', 'url5', 'drone', 'DroneType', 1, 25, false, 'active');

-- Cameras

INSERT INTO devicetype (name, image_blob, variant, dtype, mount_id, system_id, autofocus, status)
VALUES
('Canon EOS 5D Mark IV', 'url1', 'camera', 'CameraType', 6, 1, true, 'active'),
('Nikon D850', 'url2', 'camera', 'CameraType', 6, 2, true, 'active'),
('Sony Alpha a7 III', 'url3', 'camera', 'CameraType', 7, 1, true, 'active'),
('Fujifilm X-T3', 'url4', 'camera', 'CameraType', 7, 1, false, 'active'),
('Olympus OM-D E-M10 Mark III', 'url5', 'camera', 'CameraType', 8, 2, true, 'active');

-- assigning tags to devicetypes
INSERT INTO tag_devicetype (tag_tag_id, types_type_id)
VALUES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class DeviceListEntryComponent extends LitElement {
isLink></cc-property-value>
<cc-property-value size="small" property="System" value="${camera.system?.name}"
isLink></cc-property-value>
<cc-property-value size="small" property="Foto Resolution" value="${camera.photoResolution?.name}"
<cc-property-value size="small" property="Foto Resolution" value="${camera.photo_resolution?.name}"
isLink></cc-property-value>
<cc-property-value size="small" property="Autofokus"
value="${camera.autofocus ? 'Ja' : 'Nein'}"></cc-property-value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ export class DeviceTypeEditEntryComponent extends LitElement {
}

getPropertyValue(property: string, value: any){
return html`${value ? html`<cc-property-value property="${property}" value="${value}" size="${SizeEnum.SMALL}"></cc-property-value>` : ''}`
return html`${value != undefined ? html`<cc-property-value property="${property}" value="${value}" size="${SizeEnum.SMALL}"></cc-property-value>` : ''}`
}

renderCamera(cameraType : CameraType){
return html`
${this.getPropertyValue("Mount", cameraType.mount?.name)}
${this.getPropertyValue("System", cameraType.system?.name)}
${this.getPropertyValue("Foto Resolution", cameraType.photoResolution?.name)}
${this.getPropertyValue("Foto Resolution", cameraType.photo_resolution?.name)}
${this.getPropertyValue("Autofokus", cameraType.autofocus)}
`
}
Expand Down
Loading

0 comments on commit 2683a8e

Please sign in to comment.